Skip to content

Commit 7546576

Browse files
Update prime_factors.py
1 parent dd1a0c8 commit 7546576

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

maths/prime_factors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ def unique_prime_factors(n: int) -> list[int]:
7878
factors = []
7979
while i * i <= n:
8080
if not n % i:
81+
while not n % i:
82+
n //= i
8183
factors.append(i)
8284
i += 1
8385
if n > 1:

0 commit comments

Comments
 (0)