LCM of 1 to n by recursive

while 1:
 n=input();i=r=1
 while i<=n:
\x09a,b=r,i
\x09while a:a,b=b%a,a
\x09r=r*i/b;i+=1
 print r

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

download

return to the top page