LCM of 1 to n by nn

for(;n=readline(a=[]);print(a.join('')))for(a[432]=i=1;j=i++<n;){for(;c=i%++j;);for(;j>=i&&j<=n;j*=i)for(k=432;1+a[k]|c;c=c/10|0)a[k]=(c+=i*a[k--]|0)%10}

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

download

return to the top page