happy number by msk

for i in range(1,2001):\x0d
\x09n = i\x0d
\x09while n!=1 and n!=4:\x0d
\x09\x09a,b,c,d=n/1000,n/100%10,n/10%10,n%10\x0d
\x09\x09n=a*a+b*b+c*c+d*d\x0d
\x09if n==1:\x0d
\x09\x09print i\x0d
\x09\x09

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

download

return to the top page