Sorry for the simple question. But if we have a 5-digit number and each digit can hold a value from 0-9. Then how many possible combinations are there? Also, what formula can you use to get this in other situations of different digits. (If any at all).

You are watching: How many number combinations in 5 digits


*

In general, in base b, there would be bn possible combinations of n digits. For your question, you can substitute b = 10 and n = 5 to get 100000. You might have accidentally excluded the combination 00000 when you came up with 99999 as the number of combinations.

However, this includes combinations that start with 0 (e.g. 00135), which are not normally considered to be five-digit numbers. If you want to exclude those (and assuming n > 1), then you subtract away all the combinations starting with 0, of which there are bn−1, to get bn−bn−1 = (b−1)bn−1 as the final answer.


Just to make this less abstract and more concrete:

If you exclude 0 for the first digit, you have 9 options for it: 1, 2, 3, 4, 5, 6, 7, 8, 9. For the other digits, you have 10 options to pick from.

So the total number of combinations is 9×10×10×10×10 = 9×104 = (b-1) bn-1 for b = 10.


The number of 5-digit combinations is 105=100,000. So, one more than 99,999. You can generalize that: the number of N-digit combinations is 10N.

Now, this assumes that you count 00000 or 00534 as "5-digit numbers". If you choose to not count any combination of 5 digits starting with a leading 0, then the first 5-digit number is 10,000 and the last 5-digit number is 99,999. That gives you 90,000 5-digit numbers. In that case the general formula would be 9*10N-1 for the number of possible N-digit numbers.

You can generalize this formula to other bases as well. Since there are 26 letters and 10 1-digit numbers, then a case-sensitive alpha-numeric password contains 26+26+10=62 possible inputs for each character. An N-character password would therefore have 62N possible combinations.


Assuming the first digit can be 0, there are 100000 such combinations (because after chopping off the initial zeroes, each combination gives a number between 0 and 99999 and there are obviously 100000 of those).

If the first digit can't be zero (so that the number is genuinely five digits long), there are 100000 - 10000 = 90000 (we are just taking away 00000 through 09999).

See more: What Is The Difference Between Hunan And Szechuan Beef, Difference Between Szechuan And Hunan Chicken


Maybe the simplest way is just to count, no permutations/comb necessary. Smallest 5 digit number is 10000, largest 99999. And then just their difference is 89999, then add 1 to include the first number, so 90000.