mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 18:38:39 +00:00
Update prime_factorization_fast.py
This commit is contained in:
parent
b64348256f
commit
896f6bebb0
@ -49,6 +49,9 @@ def prime_factors(num: int) -> list[int]:
|
|||||||
def primeproduct(num: int) -> list[int]:
|
def primeproduct(num: int) -> list[int]:
|
||||||
"""
|
"""
|
||||||
Returns prime factors of a positive integer num as a list.
|
Returns prime factors of a positive integer num as a list.
|
||||||
|
2 is only even prime so special while loop to handle it.
|
||||||
|
Skipping other even numbers.
|
||||||
|
Taking root n approach for getting prime number.
|
||||||
|
|
||||||
>>> primeproduct(868)
|
>>> primeproduct(868)
|
||||||
[2, 2, 7, 31]
|
[2, 2, 7, 31]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user