The Lottery Ball Factory
<div class="IPBDescription">Math Savvy Beware!</div>Okay, someone told me a nice math problem the other day and I thought I'd share it. If you know the answer already, don't spoil it for others. If you post an answer, write the answer in spoiler tags, though your proof you can leave outside spoiler tags without any problems. Without further ado:
You work at a factory which creates lottery balls, the ones they draw from a cage on a random basis.
You are given the instructions to unwrap a package with the following contents: a ball and two strips of number stickers from 0 to 9. Your task is to place the stickers on the ball to create the numbers starting from 1 and then up. However, the stickers you do not use in that package, you place aside to use later. So for example, I start by taking the '1' sticker and placing it on the ball, and the 0, 2, 3, 4, 5, 6, 7, 8, 9 and the other 0 - 9 number sticker strip go to a pile. Then I open another package and I take the '2' sticker and place it on the ball, placing the 0, 1, 3, 4, 5.. and the other 0 - 9 number sticker to the same pile.
At what point do I run out of numbers using this system? I'll give you a hint, it's not a small number. <img src="style_emoticons/<#EMO_DIR#>/smile-fix.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile-fix.gif" />
Have fun!
You work at a factory which creates lottery balls, the ones they draw from a cage on a random basis.
You are given the instructions to unwrap a package with the following contents: a ball and two strips of number stickers from 0 to 9. Your task is to place the stickers on the ball to create the numbers starting from 1 and then up. However, the stickers you do not use in that package, you place aside to use later. So for example, I start by taking the '1' sticker and placing it on the ball, and the 0, 2, 3, 4, 5, 6, 7, 8, 9 and the other 0 - 9 number sticker strip go to a pile. Then I open another package and I take the '2' sticker and place it on the ball, placing the 0, 1, 3, 4, 5.. and the other 0 - 9 number sticker to the same pile.
At what point do I run out of numbers using this system? I'll give you a hint, it's not a small number. <img src="style_emoticons/<#EMO_DIR#>/smile-fix.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile-fix.gif" />
Have fun!
Comments
If f0(n) represents the number of 0s used from numbers 1 to n, f1(n) represents the number of 1s used from numbers 1 to n, etc.,
Then the solution is when the maximum value of f0(n), f1(n), f2(n),... f9(n) = 2*n.
That is to say, when the average use of one of the numbers from 0 through 9 is greater than 2 for a number n (you get 2 of each number for every number you make), you've found your answer.
So all there is left to do is figure out the formulas for f0(n) ... f9(n) and solve for n.
So what is f0(n)?
f0(0) = 1
f0(1) = 1
f0(2) = 1
...
f0(10) = 2
f0(11) = 2
...
f(99) = 10
f(100) = 12
So something like floor(n / 1000) + floor(n / 100) + floor(n / 10) + 1 = f0(n).
Am I gibbering here or is that making any sense to anybody?
Start at 1 and go as high as you can until you run out of numbers. You will eventually run out of stickers once you are in the multiple thousands (or possibly millions or higher, I don't know).
My math isn't up to snuff for this, and I don't feel like figuring it out.
Well the question is at what point will I run out of numbers using this system. I never said it stops at 36 (where did you get that number from anyway?)
If anything isn't clear, ask and I'll clarify.
An even takes place, the event includes:
1) the right to use 2 sets of 0-9
2) using your pool of numbers to create n+1 (where n is the number used in the last event)
n originates at 1.
How many events before you can not create n+1 with your current pool?
no limits, nothing like that, ignore the stupid lotto ball bit (after all, lotto balls have have at least 2 numbers on them, generally 6 or more).
It is a math question, state it as such.
I think I get what the problem is. It's not an infinite bucket, it's consecutively larger buckets. In terms of buckets, it's kinda like this:
"You have to fill buckets. Each bucket is larger than the previous. Each time you get a bucket, you also get a fixed quantity of water, X. Any water you don't need can be stockpiled. At some point, the amount of water that the buckets can hold exceeds X. When do you run out of water?"
From what I understand, we just label the balls consecutively, with no upper limit. We simply continue until we run out of numbers to label balls with. When labeling a ball, we use the numbers on the strips that come with it. Any unused numbers go into the stockpile. If the strips are not sufficient to label a ball, we dig into our stockpile.
Any number with less than twenty digits will net us an increase to our stockpile. Any number with more than twenty digits will net us a decrease. Thus, until we reach twenty digits, our stockpile will continue to increase in size. Once we are past twenty digits it will decrease in size, until we run out. The point is to figure out when we run out.
Is this correct?
Also, are we doing your math assignment for you? <img src="style_emoticons/<#EMO_DIR#>/tounge.gif" style="vertical-align:middle" emoid=":p" border="0" alt="tounge.gif" />
There is no upper bound. If you prefer to drop the lottery ball factory bit, fine by me.
I understand that maybe the wording is a little hard to get and I apologize. I mean to say that at some point, you're making numbers 21 digits long (for example.. don't assume I mean to say the answer is necessarily greater or less than a number with 21 digits) which consume 21 numbers each from your pile and from the two strips of number stickers you opened. You're no longer gaining numbers but losing them one at a time. However, if the problem were as simple as figuring out when 20 * n = log10(n), the solution would already be quick to solve.
lolfighter, I think you've got it right. When you make a single number and you do not have enough of that number from the two strips or from the pile, that number is your answer. So obviously the number could never contain less than three of any single number since you gain two of every digit for every number you need to form. Does that make any sense?
In the lotto ball example, on the other hand, you have ten different resources to keep track of, and resource requirements change from one iteration to another in a complex manner. Lot more difficult to work with.
I briefly thought about going the cheeky route and writing a program to brute-force the problem rather than bothering with doing any real math, but I quickly realised my computer would run out of memory long before getting anywhere.
That being said, I also have no intention of solving this mathematically. I hereby pass the buck.
If you want to brute-force the problem, you could take a shortcut and start at the number I calculated up to. =p
Actually, it might work, but I'd have to swap stuff in and out of memory. It'd also take forever to calculate. All in all, I REALLY can't be arsed.
buck.pass();
Edit: I might be overcomplicating things, and it might actually be brute-forcable with (under the circumstances) rather moderate memory overhead. I STILL can't be arsed though. But if anybody does want to take this rule, start by figuring out how the contents of the stockpile change over time, and whether it can be stored more efficiently than simply as a collection containing the entire contents of the stockpile.
This time we can ignore the leading 1 on all those numbers for simplicity, and just assume our supply is a single 1 instead of two of them. There's a lot of digits cycling, but most of them are 9s which can be ignored. If we count back 10 numbers, the 1 farthest right column has cycled through 1 ONE. If we count back 100 numbers, the 2 farthest right columns have each cycled through 10 ONEs. 1000 numbers, the 3 right columns have each cycled through 100 ONEs.
Lets jump to 1x10^9th numbers backwards. Hold on...did I just make a math error? Damnit, I think I dropped an entire column in my earlier calculations that got me to 2.0x10^16th. Give me a minute to go over those numbers again.
This, by the way, is the danger of working with numbers too large to write down efficiently.
So yes, 1.0x10^9th backwards from 2.0x10^15th. At this point, 9 columns have cycled through 1.0x10^8th ONEs, giving 0.9x10^9th consumed and 1.0x10^9th supplied. Close.
How about 1.0x10^10th backwards? At this point, 10 columns have cycled through 1.0x10^9th ONEs, giving 1.0x10^10th consumed and 1.0x10^10th supplied. We have found an equilibrium point! For each 1.0x10^10th we step back, we used the same number that we supplied. But we aren't quite done yet, because that gives us several different points where supply = demand, and we want the FIRST point. Anyone up for the next step?
I'd just assume search for a diamond of the size of a grain of sand amongst the beaches of the world.
Don't you think it'd be easier to match formulas?
Having determined that 1.0x10^15 - 1.0x10^10 is an equilibrium point, I would think the next step is fairly clear. It remains in equilibrium only as long as the 11th digit is not a ONE, so 1.0x10^15 - 8.0x10^10 (aka 1,999,920,000,000,000) should be the first one of this type. Stepping back one more transition gives 1,999,910,000,000,000, and that transition consumes an extra leading ONE on each number, meaning we must have first crossed equilibrium somewhere in that range.
How far back are we at 199991E10? During that period we cycle through 1x10^10 numbers, yielding 1x10^9 ONEs in 10 columns to the right, plus our two leading ONEs which exactly offset the supply. So at 199991E10, we have exactly 1x10^10th spare ONE digits. But how fast do we consume those?
At this point we don't have to worry about our supply increasing, since that's exactly offset by our two leading ones. *thinks* Actually that makes it easy. Since our supply always decreases in this area, never increases, and we know it hits exactly 0 at the end, then it can't possibly <i>cross</i> 0 until it hits the end -- with one exception. The very last number in the range is 1999992E10, and that number gives us a net +1 ONE digit, with leaves us with exactly 0 spares. So the most recent previous number at which we consumed a ONE digit is our answer. And that is...
*drumroll*
<span style='color:#000000;background:#000000'>1,999,919,999,999,991</span>
Am I close to being correct?
@Crystal: You are coming to the same upper-bound that I came to, but the upper-bound in this case is not particularly useful because you have 10 different resources which run out at different rates, and one of them is likely to run out significantly before the other nine.