Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I work out how many permutations a 18 digit number may have that using digits 0-9?

I found this (How many permutations are there if you have n+1 items, where the extra item can be repeated?) question but as I am not a mathematician I don't understand the equation cited in the answer:

Please could I get an explanation in simpler terms, assuming it is something to easily explain and it is the equation I require?

share|cite|improve this question
I don't understand your question; it seems the answer will certainly depend on your number. The number 333333333333333333 does not have any other permutations of its digits than itself, but other numbers of course have many different permutations of their digits. – Marc van Leeuwen Feb 15 '13 at 11:03
thank you for your response, I will take some time to rethink my question and reword it to make more sense, if I can, shortly. – Mr. Mr. Feb 15 '13 at 11:28
up vote 3 down vote accepted

It sounds like you're not interested in permutations. I think what you're asking is "how many 18 digit decimal numbers are there?", to which the answer is $9 \times 10^{17}$ (since there are 9 possibilities for the first digit and 10 for each of the remaining 17).

If you were interested in how many permutations there are of a particular 18 digit number, let's say we have a $k$ digit number with $d_i$ copies of the digit $i$ (so we have $k = \sum_i d_i$). So for example, the 3 digit number 122 has $d_2 = 2, d_1 = 1$ and $d_0 = d_3 = \ldots = d_9 = 0$. Then the number of permutations of this number (ignoring the leading 0 thing for a moment) is:

$$ \frac{k!}{\Pi_i d_i} $$

So to return to our example of 122, the number of permutations is:

$$\frac{3!}{2! \times 1! \times 0! \times \ldots \times 0!} = \frac{6}{2} = 3$$

What's happened is that the numerator is the number of ways of permuting all the digits (ignoring duplicate digits) and each term in the denominator is the number of ways of permuting one set of duplicate digits.

To correct for the fact that numbers aren't allowed to have leading zeroes, we can change the our formula a little in the case that our number contains one or more 0 digits by subtracting the number of permutations that have a leading 0:

$$ \frac{k!}{\Pi_i d_i} - \frac{(k-1)!}{(d_0 - 1)! \times \Pi_{i > 0}d_i!} $$

share|cite|improve this answer
so if I understand correctly my way of calculating would be by doing: 18! / 1! x 2! ... 9! – Mr. Mr. Feb 15 '13 at 12:10
Ok, I think I get it the first formula is what I am after k!/IIidi – Mr. Mr. Feb 15 '13 at 12:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.