[3.12] Add more examples to the recipe docs (GH-106782) (GH-106783)

This commit is contained in:
Miss Islington (bot) 2023-07-15 13:09:20 -07:00 committed by GitHub
parent 060f58d877
commit 18d98bacb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1045,6 +1045,8 @@ The following recipes have a more mathematical flavor:
def factor(n): def factor(n):
"Prime factors of n." "Prime factors of n."
# factor(99) --> 3 3 11 # 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): for prime in sieve(math.isqrt(n) + 1):
while True: while True:
quotient, remainder = divmod(n, prime) quotient, remainder = divmod(n, prime)