Combinations and permutations: Difference between revisions
→{{header|Perl 6}}: rephrasing + not using the Gamma name
(Added Perl Implementation) |
(→{{header|Perl 6}}: rephrasing + not using the Gamma name) |
||
Line 311:
=={{header|Perl 6}}==
Perl 6
<math>\ln n! \approx
\frac{1}{2}\ln(2\pi n) + n\ln\left(\frac{n}{e} + \frac{1}{12 e n}\right)</math>
Notice that Perl6 can process arbitrary long integers, though. So it's not clear whether using floating points is useful in this case.
Line 318 ⟶ 321:
multi C($n, $k) { P($n, $k) / [*] 1 .. $k }
sub
.5*log(2*pi*
}
Line 332 ⟶ 333:
}
multi P($n, $k, :$float!) {
(
but Logarithm
}
multi C($n, $k, :$float!) {
(
but Logarithm
}
|