-
You still have a little bit left :p
EDIT: Number of combinations = multiplying the highest numbers together. The number of numbers multiplied together is the same as the number of digits in the result. 4 digit result using 10 digits = 10*9*8*7=5040.
This reminds me of some algebra equation from my distant past. I am sure the equation I posted is flawed in some way, but it is interesting.
EDIT: Found it ref.
-
The number is easy enough to calculate mathematically, but actually finding all of the permutations directly without overgenerating* involves a ridiculous recursive function. It's a very hard task, although many other things aren't so hard.
(*Of course you can overgenerate and remove the extras as needed.)
It essentially needs to program itself. It's easy enough to write a set of embedded loops that will do it for a specific length, but allowing that to be any arbitrary length (as a parameter) is where it gets tricky.