![]() |
|
#11
|
||||
|
||||
|
(Draknek has been working this out for far too long)
Changing the number of floors is fairly trivial (once you get how to do it at all, that is - I didn't). With only two balls, the formula is: y = ceil(1/2*(sqrt(1+8x)-1)) Where y is the number of attempts you need to make and x is the number of floors. (Ceil means round up.) Showing my working backwards, that formula is produced from this one: 1/2*y*(y+1) >= x Which is, in turn, produced by this one: (Sum of a between a=1 and a=y) >= x Which is the original formula for 2 balls. For one ball, the formula is: y >=x But that is equivelant to: (Sum of 1 between a=1 and a=y) >= x Going back to 2 balls: (Sum of a between a=1 and a=y) >= x Is the same as: (Sum of (Sum of 1 between a=1 and a=b) between b=1 and b=y) >= x Extending this, for three balls, it would be: (Sum of (Sum of (Sum of 1 between a=1 and a=b) between b=1 and b=c) between c=1 and c=y) >= x However, at 2:20 in the morning, I'm not willing to work that out and get a y=blah equation for three balls. (Apologies if this makes little sense, is in a stupid order, or both. Draknek is tired now.)
__________________
Self-referential sigs do not a humourous poster make. |
| Thread Tools | |
| Display Modes | |
|
|