totient function by shinh

10000.upto(10300){|n|v=n
i=2
while n>1
if n%i==0
v=v*(i-1)/i
while n%i==0
n/=i
end
end
i+=1
end
p v}

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

download

return to the top page