#Bash/coreutils/dc, 25
Bash/coreutils/dc, 25
dc<<<"1 `seq -f%g* $1`p" This forms a dc script and evaluates it. So ,with input of 5, we evaluate
1 1* 2* 3* 4* 5*p It took my machine 2.05 seconds to compute 10000! here (that's factorial ten-thousand, with 36693 digits), so seems to scale reasonably well. For the zero case, seq produces no output, so the dc script is just 1 p which produces the correct output 1.