Left factorials: Difference between revisions

Content added Content deleted
(C solution addition.)
m (→‎{{header|Perl}}: Mention >100x speedup using Math::GMP)
Line 602: Line 602:
=={{header|Perl}}==
=={{header|Perl}}==
By caching the last used factorial and left factorial values, I avoid needless recomputation. By only retaining the most recently used values, instead of all past values, I avoid the need to store twenty thousand enormous numbers.
By caching the last used factorial and left factorial values, I avoid needless recomputation. By only retaining the most recently used values, instead of all past values, I avoid the need to store twenty thousand enormous numbers.

If performance is a concern, this will run over 100x faster by replacing the line "use bigint" with "use Math::GMP qw/:constant/" (after installing that module).


<lang perl>#!perl
<lang perl>#!perl