BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
Update2: 13824 is 29 * 33; but how you get that from 3 & 4 or 12 & 3 or 12 & 4???
If you have N identical sets of M different things, how many different orderings can they be arranged in? (Ie. What's the formula?)
Eg. if you have 2 sets of 3: my %stats; ++$stats{ join'', shuffle( ( 1..3 ) x 2 ) } for 1 .. 1e6
For the above example, with M=3 and varying N, I gets the following numbers:
And for M=4:
And for M=5:
Oh. And for the "What have you tried" crowd: I've been thinking about it for days; I've stared at the various algorithms in Algorithm::Combinatorics trying to work out which is applicable; and a few unsuccessful google searches looking for a relevant problem description.
As you can see, the numbers compound very quickly; and I need to calculate for considerably higher numbers; but I cannot wrap my brain around it.
For the very simplest (first) case above I get these results:
If you count the number of 1s,2s,& 3s in the 6 columns they are all equal at 30; hence 90 possible comb/permutations. But if there was a free choice of digit for all positions; it would be 36==729 combinations.
And if you could treat each group separately as permutations, and combined them it would be 3! * 3! = 36.
At this point, I've run out of ideas, so ... this post.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Combinatorics formula
by tybalt89 (Monsignor) on Oct 19, 2016 at 00:03 UTC | |
by Anonymous Monk on Oct 19, 2016 at 00:16 UTC | |
by BrowserUk (Patriarch) on Oct 19, 2016 at 00:11 UTC | |
|
Re: Combinatorics formula
by pryrt (Abbot) on Oct 19, 2016 at 00:06 UTC | |
by BrowserUk (Patriarch) on Oct 19, 2016 at 00:11 UTC |