https://github.com/python/cpython/commit/0b31a50ecd494d76e4254d4b2de18e5926683124
commit: 0b31a50ecd494d76e4254d4b2de18e5926683124
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: rhettinger <[email protected]>
date: 2024-01-08T19:22:42Z
summary:

[3.12] Minor algebraic simplification for the totient() recipe (gh-113822) 
(gh-113823)

files:
M Doc/library/itertools.rst

diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index a0181612d5bb67..67dc8f6d875f68 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -1142,7 +1142,7 @@ The following recipes have a more mathematical flavor:
        # https://mathworld.wolfram.com/TotientFunction.html
        # totient(12) --> 4 because len([1, 5, 7, 11]) == 4
        for p in unique_justseen(factor(n)):
-           n = n // p * (p - 1)
+           n -= n // p
        return n
 
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to