## Anagram Numbers

What are the odds that a number will contain intact groups in an anagram of another number?

The number of groups multiplied by one raised to the power of the length of the number less the number of groups.

ng * 1 ^ (nl – ng) = ng

For example, an anagram for 12345 would be 34512. There are two intact groups, 345 and 12 in the anagram number. The second anagram number could start with either a 1 or a 3, so ng = 2. The numbers that follow 1 or 3 may not permute, so those places multiply by 1.

If there are numbers between the two groups that do not match, there would be non-matching numbers, nmn, if the two numbers were instead 123045 and 345127.

ng * 10 * nmn * 1 ^ (nl – ng) = ng * nmn

Finally, the odds would compare to the total possible numbers which would be the 1 raised to the length of the number, or in our first example, 12345 would be 1E5 and 1E6 for our second number.

The odds for our first pair of numbers would then be 1 : 50,000

ng / 1Enl = 2 / 1E5 = 2 / 1E5 = 1 : 5E4.