# Lottery ball problem - How to go about solving?

A woman works at a lottery ball factory. She's instructed to create lottery balls, starting from number 1, using the following steps:

1. Open lottery ball package and remove red rubber ball.
2. Using two strips of digit stickers (0 through 9), create the current number by pasting the digits on the ball.
3. Digits not used in this way are put in a bowl where she may fish for other digits if she's missing some later.
4. Proceed to the next ball, incrementing the number by one.

The lottery ball problem is, at what number will she arrive at before she's out of digits (granted, it's a large number, so assume these are basketball-sized rubber balls)?

My question is not so much the solution as it is how to go about solving for this number? It seems evident that the first digit she'll run out of will be 1, since that's the number she starts with, however beyond that I wouldn't know how to go about determining that number. Any clues that could push me in the right direction would be greatly appreciated.

-
How is this related to fractals? –  Raskolnikov May 6 '11 at 13:20
Or analyis :) ? –  Phira May 6 '11 at 13:23
I don't know! :( Feel free to modify the keywords since I'm not sure how to categorize this. –  Neil May 6 '11 at 13:26

## 1 Answer

Yup, the first digit you run out of will be 1. As to how to solve it - try writing a formula for the number of $1$s in the decimal representations of the first $n$ numbers, and try and work out when it overtakes $2n$.

-
Oh - you'll find the formula easier if you (a) only try and work it out for certain numbers, and (b) if you pretend she started at 0 instead of 1 (this won't change the answer). –  IainM May 6 '11 at 13:25
The number of 1s in a number n can't be written in a formula, can it? I think if I had a formula like that, solving for f(n) exceeding 2n would be simple. –  Neil May 6 '11 at 13:29
The number of 1s in n would be messy, yes. The number of 1s in the first n numbers - less so, especially when n takes certain values... :) –  IainM May 6 '11 at 13:32
It's a good start I suppose. I'll have to dwell on that thought. –  Neil May 6 '11 at 16:13
@IainM You are right, of course, but I do not have the time to fix my answer at the moment, so I deleted it. –  Phira May 6 '11 at 16:46