Who is good at Math, Specifically Stats

D

Dundee

Guest
I am OK at maths up to a point. I blundered my way through 1st year UNI calculus and forgot most of it 5 mins after the final.
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.
 
  • Like
Reactions: Fish
I bet @Fish knows how to solve it. She's a smarty pants.
Ha Ha Ha Stop playing Dumb Leta, I have seen you slip once or twice and let down the disguise, the math you did would make Doc Brown cry.
You could solve this with a pen tied to an eylash with your eyes closed in a bucket of water. Hanging upside down in a vacume.
 
However you do it there will be 4 to power 10 possible combinations (I think) which is 1,048,576.

Should be enough.

But I suspect you can get all the possible combinations by using four nested loops.
 
However you do it there will be 4 to power 10 possible combinations (I think) which is 1,048,576.

Should be enough.

But I suspect you can get all the possible combinations by using four nested loops.
Yeah that makes sense to me a little. I sort of need a worked example for both cases so I can code it.
Thanks mate.
 
Check out the big brain on HAL!

Cat Wow GIF
 
  • Haha
  • Like
Reactions: Fish and Dundee
If you are using a 4x4 keypad, then there are only 16 possible combinations.

If it was on a computer you could use a String comparison.

Say A=5,b=3,c=9,d=6

So the entry code is 5396.

The program sets A$ as 5396.

Chummy enters his four numbers.

Computer checks A$ is equal to the four he entered.

If not it rejects the attempt.
Allow three attempts, then have computer phone the cops and pick him up.

I'll let you fill in the gaps.
 
  • Like
Reactions: Fish