Totient by hallvabo

def R(n):
 if n==2or pow(2,n,n)==2:return n
 for c in 2,4,5:
\x09i=k=x=y=2
\x09while i<177:
\x09 x=(x*x+c)%n;g,h=y-x,n;i+=1
\x09 while h:g,h=h,g%h
\x09 if 1<g<n:return g
\x09 if~-i==k:y=x;k*=2
while 1:
 t=n=input()
 while n>1:
\x09f=R(R(n))
\x09while n%f<1:n/=f
\x09t=t*~-f/f
 print t

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top