Minor algebraic simplification for the totient() recipe (gh-113822)

This commit is contained in:
Raymond Hettinger 2024-01-08 13:16:22 -06:00 committed by GitHub
parent 35fa13d48b
commit aef375f56e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1150,7 +1150,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