Jump to content

Left factorials: Difference between revisions

m
→‎{{header|Perl 6}}: remove surnumerary word
m (→‎{{header|Perl}}: Mention >100x speedup using Math::GMP)
m (→‎{{header|Perl 6}}: remove surnumerary word)
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.
 
In this case, since we aren't actually interested in the factorials, we could have just written combined the two definitions into one:
<lang perl6>constant leftfact = 0, [\+] 1, [\*] 1..*;</lang>
(No significant difference in run time.)
1,935

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.