Update prime_factorization_fast.py

This commit is contained in:
Sourabh kumar verma 2023-08-22 00:13:19 +05:30 committed by GitHub
parent b64348256f
commit 896f6bebb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,9 @@ def prime_factors(num: int) -> list[int]:
def primeproduct(num: int) -> list[int]:
"""
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)
[2, 2, 7, 31]