Credit cards typically use a 4 digit pin. You've recently come across a credit card and are trying to guess the pin so that you can buy yourself a new TV or a pony.

You have a machine that lets you continuously enter digits until you've entered the correct 4 digit sequence. If the pin was 1234, then you could enter 1234, 096791234, 111234, etc to get in. Thus you can brute force the problem in around 40,000 steps. You don't want to spend the entire day entering numbers though. How can you solve this in less than 40,000 steps?

Enjoy your weekend!

## Comments:

Anonymous - 4 years, 2 months ago

Shouldn't a 4 digit pin have at most 10,000 steps?

reply permalink

Anonymous - 4 years, 2 months ago

Put a gun to card holder's head and ask (not so politely) for his PIN.

reply permalink

Daniel - 4 years, 1 month ago

A 4 digit pin has 10000 possible combinations. Assuming that you can continuously enter digits, you will need to enter 10003 numbers assuming you enter a sequence with maximum overlap. For example, the sequence 00110 has all possible 2-binary digit combinations in it. Each consecutive pair of numbers is a different combination.

reply permalink