Based on wikipedias description about Euler's Totient Function, i wrote the following code:
from math import gcd
def phi(n):
amount = 0
for k in range(1, n + 1):
if gcd(n, k) == 1:
amount += 1
return amount
It works fine for small numbers, but i want to compute the totient function for numbers such as n = 5692297035794675412610596123456169
Is there any better way to compute the Totoent function for such as big inputs?