D

#### Dundee

##### Guest

Still remember most of what came before all that though, Did pretty good in physics at UNI.

But I only ever did one unit of stats, and I was not good at that either.

I have a stats question if anyone can help.

If I have a keypad with 0 to 9, about all I can remember is that to find the maximum number of combinations it is 10 Factorial, ie:

10x9x8x7......x1 = n combinations.

But I want to know how to calculate two things.

1. For a 4 digit code on that keypad, where order is relevant. Whats the algorithm to print out all possible combinations.

2. For a 4 digit code on that keypad, where order is NOT relevant. Whats the algorithm to print out all possible combinations.

So

case 1. 1234 is not the same as 4321 or 2314

case 2. 1234 is the same as 4321or 2314

If anyone is accross how to do this I suspect you could replace the 4 (number of digits in the code) with an X

Oh I am not up to no good by the way. It is just something in a program I began to write.

Thanks in advance.