# Calculating the probabilities of different lengths of repetitions of numbers of length 6

This question is similar to the question I asked here: Calculating the probabilities of different lengths of repetitions of numbers of length 4 except now I'm having problem with numbers of length 6.

I'm trying to calculate the probabilities of different lengths of repetitions of numbers of length 6 however I know I'm doing it incorrectly since when I add all the probabilities together they don't total to 1

e.g. Here is my reasoning to calculate the probabilities of the different lengths repetitions for length 6

{ 1 => 6 } = e.g. numbers that fit the pattern ABCDEF = 9^5/10^5

{ 1 => 4, 2 => 1 } = e.g. numbers that fit the pattern AABCDE or ABBCDE or or ABCCDE or ABCDDE or ABCDEE = 9^4 * 5/10^5

{ 1 => 2, 2 => 2 } = 9^3 * 4/10^5

{ 2 => 3 } = 9^2/10^5

{ 1 => 3, 3 => 1 } = 9^3 * 4/10^5

{ 1 => 1, 2 => 1, 3 => 1 } = 9^2 * 3/10^5

{ 3 => 2 } = 9/10^5

{ 1 => 2, 4 => 1 } = 9^2 * 3/10^5

{ 2 => 1, 4 => 1 } = 9 * 2/10^5

{ 1 => 1, 5 => 1 } = 9 * 2/10^5

{ 6 => 1 } = 1/10^5

When I add the number of outcomes I get 98299/100000, when I should be getting a 1. Anyone know what I'm doing wrong?

Bonus Question: Is there a library out there that can automatically calculate these different partitions for me? It's essentially what I'm building/programming.

Got it ... I wasn't generating the all the possible permutations for each case. The algorithm to do it is e.g.

Repetition Hash {3 => 1, 2 => 1, 1 => 1}

Iterate through each key and add it to the empty string. Update the repetition hash. If the empty string has your desired length, then you've found a permutation.

e.g. First Iteration 333 22 1

Second Iteration 33322 3331 22333 221 122 1333

Third Iteration 333221 333122 223331 221333 122333 133322

-
Your second case misses ABCDDE. – vadim123 May 22 '13 at 22:13
What does x^^y denote? Does it denote $y_x$, i.e. $y \text{ base } x$? I ask since you also use x^y, which I assume denotes $x^y$? If you use $\LaTeX$ such confusion can be avoided, and you might get answers quicker. – JohnWO May 22 '13 at 22:15
Added more cases to the second case. Not sure if it's worth it for me to learn LATEX... – Waley Chen May 22 '13 at 22:19