# Do you have a formula for this word puzzle?

This is not an arbitrary question; it actually has a use. I find that the logic behind the use is also quite interesting. You have a combination padlock with four dials on it. Each dial has the numbers 0 through 4 on them. The lock can have as many 0s as dials, and is set to 0000 by default. The lock does not... show more This is not an arbitrary question; it actually has a use. I find that the logic behind the use is also quite interesting.

You have a combination padlock with four dials on it. Each dial has the numbers 0 through 4 on them. The lock can have as many 0s as dials, and is set to 0000 by default. The lock does not allow you to use any number between 1 and 4 two or more times in the combination. The following combinations are valid: 0123 1234 0103 0010 4031. The following combinations are invalid: 0113 4014 0202 4444. How many possible combinations are there?

I would like to have a formula that defines this well enough to calculate, simply, the possible amount of combinations.