[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-08-03 14:31:11 +00:00
parent 8bd2067393
commit bb34d5d215

View File

@ -1,15 +1,16 @@
from math import ceil, sqrt from math import ceil, sqrt
from __future__ import annotations from __future__ import annotations
def primeproduct(n: int, x: list = []): def primeproduct(n: int, x: list = []):
''' """
>>> primeproduct(868) >>> primeproduct(868)
[2, 2, 7, 31] [2, 2, 7, 31]
>>> primeproduct(9039423423423743) >>> primeproduct(9039423423423743)
[2, 2, 7, 31, 719, 12572216166097] [2, 2, 7, 31, 719, 12572216166097]
>>> primeproduct(0.02) >>> primeproduct(0.02)
[] []
''' """
if n < 1: if n < 1:
return [] return []
@ -30,7 +31,6 @@ def primeproduct(n : int, x : list = []):
flag = 1 flag = 1
break break
else: else:
# Handle factor 2 separately # Handle factor 2 separately
while n % 2 == 0: # only 2 is even prime while n % 2 == 0: # only 2 is even prime
@ -53,6 +53,7 @@ def primeproduct(n : int, x : list = []):
return x return x
# faster than https://github.com/sourabhkv/Python/blob/master/maths/prime_factors.py approx 2x # faster than https://github.com/sourabhkv/Python/blob/master/maths/prime_factors.py approx 2x
if __name__ == "__main__": if __name__ == "__main__":
import doctest import doctest