Left factorials: Difference between revisions

Content deleted Content added
m →‎{{header|Perl}}: Mention >100x speedup using Math::GMP
Grondilu (talk | contribs)
m →‎{{header|Perl 6}}: remove surnumerary word
Line 683: Line 683:
Note that we just use subscripting on the list rather than an explicit function call to retrieve the desired values. If you time these two solutions, the second will run about 280 times faster than the first.
Note that we just use subscripting on the list rather than an explicit function call to retrieve the desired values. If you time these two solutions, the second will run about 280 times faster than the first.


In this case, since we aren't actually interested in the factorials, we could have just written combined the two definitions into one:
In this case, since we aren't actually interested in the factorials, we could have just combined the two definitions into one:
<lang perl6>constant leftfact = 0, [\+] 1, [\*] 1..*;</lang>
<lang perl6>constant leftfact = 0, [\+] 1, [\*] 1..*;</lang>
(No significant difference in run time.)
(No significant difference in run time.)