Last active
October 18, 2020 20:53
-
-
Save p-pavel/d9ae755a2e120216289ac5da39831ea5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
factorial[n_] := | |
Block[{$IterationLimit = \[Infinity]}, factorial[n, 1]]; | |
factorial[0, res_] := res; | |
factorial[n_, res_] := factorial[n - 1, n res]; | |
Length @ IntegerDigits @ factorial[100000] // AbsoluteTiming (*{0.96279, 456574}*) | |
Length @ IntegerDigits @ (100000!) // AbsoluteTiming (* {0.050641, 456574} *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment