Factorial by murky-satyr

for n in io.lines()do
a={1}m=2 c=0
for i=2,n do
k=1
while c>0 or k<m do t=c+i*(a[k]or 0)c=t/10-t/10%1 a[k]=t%10 k=k+1 end
m=k
end
print(table.concat(a):reverse())end

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

download

return to the top page