mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-07 03:07:46 +08:00
Factors of a number (#1493)
* Factors of a number * Update factors.py * Fix mypy issue in basic_maths.py * Fix mypy error in perceptron.py * def primes(max: int) -> List[int]: * Update binomial_heap.py * Add a space * Remove a space * Add a space
This commit is contained in:

committed by
Christian Clauss

parent
f8e97aa597
commit
53ff735701
@ -67,10 +67,8 @@ def euler_phi(n: int) -> int:
|
||||
>>> euler_phi(100)
|
||||
40
|
||||
"""
|
||||
l = prime_factors(n)
|
||||
l = set(l)
|
||||
s = n
|
||||
for x in l:
|
||||
for x in set(prime_factors(n)):
|
||||
s *= (x - 1) / x
|
||||
return int(s)
|
||||
|
||||
|
Reference in New Issue
Block a user