Skip to content

Commit 221c8d6

Browse files
authored
[3.12] Sync factor() recipe with main branch (gh-110231)
1 parent 25bf056 commit 221c8d6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Doc/library/itertools.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,7 @@ The following recipes have a more mathematical flavor:
11191119
# factor(1_000_000_000_000_007) --> 47 59 360620266859
11201120
# factor(1_000_000_000_000_403) --> 1000000000000403
11211121
for prime in sieve(math.isqrt(n) + 1):
1122-
while True:
1123-
if n % prime:
1124-
break
1122+
while not n % prime:
11251123
yield prime
11261124
n //= prime
11271125
if n == 1:

0 commit comments

Comments
 (0)