Question DSA-MATH-0062
HardWhat is the output of this code?
def phi(n):
r, p = n, 2
while p * p <= n:
if n % p == 0:
while n % p == 0: n //= p
r -= r // p
p += 1
if n > 1: r -= r // n
return r
print(phi(100), phi(97), phi(1))
- A.
40 96 0
- B.
40 97 1
- C.
Sign up free to see the answer and a step-by-step explanation.