Skip to content

Commit e2ec0ba

Browse files
authored
Add more examples to the recipe docs (GH-106782)
Demonstrate that factor() works for large composites and large primes.
1 parent 22980dc commit e2ec0ba

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Doc/library/itertools.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,8 @@ The following recipes have a more mathematical flavor:
10451045
def factor(n):
10461046
"Prime factors of n."
10471047
# factor(99) --> 3 3 11
1048+
# factor(1_000_000_000_000_007) --> 47 59 360620266859
1049+
# factor(1_000_000_000_000_403) --> 1000000000000403
10481050
for prime in sieve(math.isqrt(n) + 1):
10491051
while True:
10501052
quotient, remainder = divmod(n, prime)

0 commit comments

Comments
 (0)