lolibility
lolibility

Reputation: 2187

perl number of combination or permutation

I want to calculate the number of combinations when given some number, e.g number of combinations when 5 choose from 10. But the Math::Combinatorics module gives you the combination lists when given character set. Is there such a module or I need to use factorial functions to represent it when programming?

Upvotes: 1

Views: 641

Answers (1)

Ted Hopp
Ted Hopp

Reputation: 234797

You can use Math::Combinatorics and count the size of the returned list. However, a better module would be Math::Counting.

use Math::Counting ':big';
printf "C(10, 5) = %d\n", bcomb(10, 5);

Upvotes: 3

Related Questions