Euler function
The natural number n is given, determine the amount of natural numbers smaller than N and mutually simple with n.
Input data
It is given a natural number N≤10 9 sup>.
output
Display φ (n).
Enter
ten
output
4
I do not understand how to solve this task!
Answer 1, Authority 100%
That’s, I even managed to write 🙂
defi (n):
f = n;
IF N% 2 == 0:
While N% 2 == 0:
n = n // 2;
f = f // 2;
i = 3.
While I * i & lt; = n:
IF N% i == 0:
While N% i == 0:
n = n // i;
f = f // i;
f = f * (i-1);
i = i + 2;
IF N & GT; 1:
f = f // n;
f = f * (n-1);
RETURN F;
Print (Fi (int (Input ())));