Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Dec 11, 2024
1 parent 328d9a4 commit bb65ce8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/largestfactor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
n = int(input())
factors = []
d = 2
while n > 1:
while n % d == 0:
factors.append(d)
n //= d
d = d + 1
if d * d > n:
if n > 1:
factors.append(n)
break
print(factors[-1])

0 comments on commit bb65ce8

Please sign in to comment.