# Problem of the DayA new programming or logic puzzle every Mon-Fri

## Pin Hack

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!

Permalink: http://problemotd.com/problem/pin-hack/

## Comments:

• Anonymous - 8 years ago

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

• Anonymous - 8 years ago

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

• Daniel - 7 years, 10 months 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.

Content curated by @MaxBurstein