10
$\begingroup$

You initially have 100 of each digit from 0 to 9. This means you have 1000 digits in total. This count for each digit is shown in the table below.

enter image description here

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:

enter image description here

What is the largest number you can count to without running out of the digits needed to form the number?

$\endgroup$
  • 1
    $\begingroup$ Hi. You should probably clarify whether you have to use all of the numbers from 1 to the limit, or if numbers can be skipped. $\endgroup$ – Spencer Feb 13 at 23:55
9
$\begingroup$

You can count to:

162

Because:

It's quite obvious that the 1 will be the most used digit, since it's the lowest non-zero digit. Now, there are twelve 1 from 1-20. After that, it's an additional one 1 per ten, up til 99, making it 20. Now, we continue adding 1 every count, in addition to the extra ones in 101, 121, 131, 141, 151, 161, a and 110-119.

It's basically:

21 + 9 for 1...99, then we add +1 for numbers 100...199, +1 for every tenth, 101, 111, 121, 131, ..., as well as the extra 9 ones for 110-119.

Check the edit history (it took too much vertical space) for an exhaustive demonstration (credit to @Avi):

| improve this answer | |
$\endgroup$
  • $\begingroup$ Beat me to it by four minutes - good work! $\endgroup$ – LizWeir Feb 13 at 15:26
  • $\begingroup$ Pipped me by ~ 10 seconds :x $\endgroup$ – Avi Feb 13 at 15:26
5
$\begingroup$

My calculations are a little rushed, but I think the answer is:

162

Working:

The dominant factor is going to be 1s - in particular we use one for every number from 100 to 199, so we can't possibly reach 200. We use at least one 1 for every other digit we count, since 1 always comes up first.
I homed in by trial and error, but the trick I used was calculating each place separately:
In the hundreds place, we use 63 copies of 1, for the numbers 100 to 162.
In the tens place, we use 20 - 10 to 19 and 110 to 119 (we've already counted the 100s places).
In the ones place, we use one in each ten numbers, for 17 total - (0)1, 11, 21, 31, ... 161

If I haven't made an arithmetic error (like the one I caught while typing!) that gives us our answer

| improve this answer | |
$\endgroup$
  • $\begingroup$ Pipped by four minutes! $\endgroup$ – LizWeir Feb 13 at 15:24
3
$\begingroup$

Same answer

162

as the preceding ones, but this is by a quick Perl 5 one-liner I threw together.

perl -E"@a=(100)x10;L:say++$i;$a[$_]--for($i=~/./g);goto L unless grep{$_<=0}@a"

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.