Dropping Eggs

You have e e test eggs and p p test parachutes.

You wish to determine the maximum height (in integer metres) that you can drop an egg + parachute at without the egg breaking before mass producing the parachutes.

The parachutes are single use, and the eggs can be used until they break.

You drop eggs + parachutes at integer metre heights until you have determined the maximum height or you run out of eggs or parachutes.

n ( e , p ) n(e,p) is the maximum determinable height, such that, if the egg's maximum height is x n ( e , p ) x \leq n(e,p) one can guarantee they can determine x x with e e eggs and p p parachutes.

n ( 1 , 10 ) = 10 n(1,10) = 10 and n ( 2 , 2 ) = 3 n(2,2) = 3 for example.

Determine n ( 5 , 11 ) n(5,11) .


The answer is 1023.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Alex Burgess
Mar 27, 2019

First one can note that n ( 0 , p ) = 0 = n ( e , 0 ) , n ( 1 , p ) = p , n ( p + a , p ) = n ( p , p ) = 2 p 1 n(0,p) = 0 = n(e,0), n(1,p) = p, n(p+a,p) = n(p,p) = 2^p - 1 , for a 0 a \geq 0 , the latter inequality being that we can do a binary search for x [ 0 , 2 p 1 ] x \in [0,2^p - 1] .

n ( e , p ) = ( n ( e 1 , p 1 ) + 1 ) + ( n ( e 1 , p 2 ) + 1 ) + . . . + ( n ( e 1 , 1 ) + 1 ) + ( n ( e 1 , 0 ) + 1 ) n(e,p) = (n(e-1,p-1) + 1) + (n(e-1,p-2) + 1) + ... + (n(e-1,1) + 1) + (n(e-1,0) + 1) , as we can 1st test height ( n ( e 1 , p 1 ) + 1 ) (n(e-1,p-1) + 1) , and if the egg breaks we run the method for e 1 e-1 eggs and p 1 p-1 parachutes on the ( n ( e 1 , p 1 ) (n(e-1,p-1) discrete metres below.

Note, n ( 1 , p ) n(1,p) is of order O ( p 1 ) O(p^1) . n ( 2 , p ) n(2,p) is the sum of these, so is O ( p 2 ) O(p^2) . Similarly, we can see that n ( e , p ) n(e,p) is O ( p e ) O(p^e) .

Looking at a table of differences for n ( e , p ) n(e,p) across different values of p p : p = 0 1 2 3 . . . e e + 1 . . . n ( e , 0 ) n ( e , 1 ) n ( e , 2 ) n ( e , 3 ) . . . n ( e , e ) n ( e , e + 1 ) . . . \begin{matrix} p=0 && 1 && 2 && 3 & ... & e && e+1 & ...\\ n(e,0) && n(e,1) && n(e,2) && n(e,3) & ... & n(e,e) && n(e,e+1) & ... \end{matrix}

.

Using n ( p + a , p ) = n ( p , p ) = 2 p 1 n(p+a,p) = n(p,p) = 2^p - 1 :

p = 0 1 2 3 . . . e e + 1 . . . Δ 0 2 0 1 2 1 1 2 2 1 2 3 1 . . . 2 e 1 n ( e , e + 1 ) . . . Δ 1 2 0 2 1 2 2 . . . 2 e 1 . . . Δ 2 2 0 2 1 2 2 . . . Δ 3 2 0 2 1 . . . Δ e 2 0 2 0 2 0 . . . \begin{matrix} & p=0 && 1 && 2 && 3 & ... & e && e+1 & ...\\ \Delta_0 & 2^0 - 1 && 2^1 - 1 && 2^2 - 1 && 2^3 - 1 & ... && 2^e - 1 && n(e,e+1) & ... \\ \Delta_1 && 2^0 && 2^1 && 2^2 && ... & 2^{e-1} && ...\\ \Delta_2 &&& 2^0 && 2^1 && 2^2 & ...\\ \Delta_3 &&&& 2^0 && 2^1 && ...\\ &&&&& \ddots &&& \vdots \\ \Delta_e &&&&&& 2^0 && 2^0 && 2^0 & ... \end{matrix}

Because n ( e , p ) = O ( p e ) n(e,p) = O(p^e) the Δ e \Delta_e row is all the same value, which will be 2 0 = 1 2^0 = 1 .

The equation for n ( e , p ) n(e,p) can be found by summing at the leftmost value of row Δ i \Delta_i multiplied by ( p i ) \binom{p}{i} .

Hence, n ( e , p ) = i = 1 e ( p i ) n(e,p) = \sum_{i=1}^{e} \binom{p}{i} .

n ( 5 , 11 ) = i = 1 5 ( 11 i ) = i = 0 5 ( 11 i ) 1 = 2 11 2 1 = 1023 n(5,11) = \sum_{i=1}^{5} \binom{11}{i} = \sum_{i=0}^{5} \binom{11}{i} - 1 = \frac{2^{11}}{2} - 1 = 1023 .


One can also notice that m = 1 p ( m n ) = ( p + 1 n + 1 ) \sum_{m=1}^{p} \binom{m}{n} = \binom{p+1}{n+1} .

So induction can be used to get n ( e , p ) = i = 1 e ( p i ) n(e,p) = \sum_{i=1}^{e} \binom{p}{i} , using the base case n ( 0 , p ) = 0 n(0,p) = 0 and using n ( e , p ) = [ i = 0 p 1 n ( e 1 , i ) ] + p n(e,p) = [\sum{i=0}^{p-1} n(e-1,i) ] + p .

Inductive step: assuming n ( k , p ) = i = 1 k ( p i ) n(k,p) = \sum_{i=1}^{k} \binom{p}{i} for all p p , n ( k + 1 , p ) = [ i = 0 p 1 n ( k , i ) ] + p = [ i = 0 p 1 j = 1 k ( i j ) ] + p = [ j = 1 k [ i = 0 p 1 ( i j ) ] ] + p = [ j = 1 k ( p j + 1 ) ] + ( p 1 ) = j = 1 k + 1 ( p j ) n(k+1,p) = [\sum_{i=0}^{p-1} n(k,i) ] + p = [\sum_{i=0}^{p-1} \sum_{j=1}^{k} \binom{i}{j} ] + p = [\sum_{j=1}^{k} [\sum_{i=0}^{p-1} \binom{i}{j}] ] + p = [\sum_{j=1}^{k} \binom{p}{j+1}] + \binom{p}{1} = \sum_{j=1}^{k+1} \binom{p}{j} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...