The challenge idea is credited to HelloWorld1337.
You initially have x of each digit from 0 to 9. This means you have x * 10 digits in total. This count for each digit is shown in the table below.
Digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|---|
# Remaining | x | x | x | x | x | x | x | x | x | x |
Now start counting by ones, from 1. Each time you say a number you must remove the digits required to make the number from your stockpile of digits. For example, after you have counted from 1 to 13, the above table now looks like:
As an example, if you counted from 1 to 13 and didn't skip any numbers, the above table will look like:
Digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|---|
# Remaining | x-1 | x-6 | x-2 | x-2 | x-1 | x-1 | x-1 | x-1 | x-1 | x-1 |
What is the largest number x you can count to without running out of the digits needed to form the number?