23 lines
366 B
Python
23 lines
366 B
Python
#!/usr/bin/env python3
|
|
|
|
from Cryptotools.Utils.utils import gcd
|
|
|
|
|
|
# https://oeis.org/A000010
|
|
def phi(n):
|
|
"""
|
|
This function count all phi(n)
|
|
|
|
Args:
|
|
n (integer): it's the phi(n) value
|
|
|
|
Returns:
|
|
Return the phi(n)
|
|
"""
|
|
y = 1
|
|
for i in range(2, n):
|
|
if gcd(n, i) == 1:
|
|
y += 1
|
|
return y
|
|
|