n = int(input("Enter Number: "))
totient = [i for i in range(n+1)]
for i in range(2, n+1):
if totient[i] == i:
for j in range(2*i, n+1, i):
totient[j] *= i-1
totient[j] /= i
totient[i] = i-1
print("totient:", totient[n])
# Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP