LCM of 1 to n by 51b

import std.stdio,std.bigint;void main(){BigInt a,b,c,t;for(int n;a=1,~scanf("%d",&n);writeln(a))foreach(i;1..n+1){for(b=i,c=a;b>0;c=t)t=b,b=c%b;a=a*i/c;}}

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

download

return to the top page