NAME

Math::Counting - Counting operations for probability and combinatorics

SYNOPSIS

use Math::Counting qw( factorial permutation combination );

my $n = 123;
my $r = 42;

printf "Given n=%d and r=%d:\nFact=%d\nPerm=%d\nComb = %d\n",
  $n, $r,
  factorial($n), permutation($n, $r), $x->combination($n, $r);

DESCRIPTION

Compute the numerical factorial, number of permutations or combinations with the technique of "tail call elimination."

FUNCTIONS

factorial

$f = factorial($n);

Return the factorial of n.

permutation

$p = permutation($n, $r);

Return the number of permutations.

combination

$c = combination($n, $r);

Return the number of combinations.

THANK YOU

Mark Jason Dominus <mjd@cpan.org> for writing Higher Order Perl.

SEE ALSO

http://www.plover.com/~mjd/misc/perl/pc.pl

COPYRIGHT

Copyright 2005, Gene Boggs, All Rights Reserved

LICENSE

You may use this module under the terms of the BSD, Artistic, or GPL licenses, any version.

AUTHOR

Gene Boggs <gene@cpan.org>