From e2ec0bad67552e27174255db86dda90fc72e6694 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 15 Jul 2023 14:43:09 -0500 Subject: Add more examples to the recipe docs (GH-106782) Demonstrate that factor() works for large composites and large primes. --- Doc/library/itertools.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index a2d1798..f885254 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -1045,6 +1045,8 @@ The following recipes have a more mathematical flavor: def factor(n): "Prime factors of n." # factor(99) --> 3 3 11 + # factor(1_000_000_000_000_007) --> 47 59 360620266859 + # factor(1_000_000_000_000_403) --> 1000000000000403 for prime in sieve(math.isqrt(n) + 1): while True: quotient, remainder = divmod(n, prime) -- cgit v0.12