mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 02:18:39 +00:00
Update prime_factorization_fast.py
This commit is contained in:
parent
2a37bbf8c5
commit
88d939422d
@ -18,8 +18,7 @@ def primeproduct(num: int) -> list[int]:
|
||||
if num <= 1:
|
||||
return []
|
||||
|
||||
prime_factors = []
|
||||
|
||||
prime_factors: list[int] = []
|
||||
while num > 1:
|
||||
if len(prime_factors) >= 1 and prime_factors[-1] % num == 0:
|
||||
prime_factors.append(prime_factors[-1])
|
||||
@ -56,7 +55,6 @@ def primeproduct(num: int) -> list[int]:
|
||||
return prime_factors
|
||||
|
||||
|
||||
# faster than https://github.com/sourabhkv/Python/blob/master/maths/prime_factors.py approx 2x
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user