Pyramid Scheme

Consider a pyramid with 2017 rows made up of empty boxes. The first (top) row has 1 box, and each successive row has an additional box so that the 201 7 th , 2017^\text{th}, bottom row has 2017 boxes.

First, place each of the first 2017 positive integers into the boxes in the bottom row. Then, each empty box in the 201 6 th 2016^\text{th} row is filled with the sum of the two numbers beneath it. Then, each successively higher row of boxes is filled in the same way.

Let M M and m m be the maximum and minimum possible values, respectively, of the single box on the top. Then M + m = a × 2 b , M + m = a \times 2^b, where a a and b b are positive integers such that b b is as large as possible. Find the value of a + b . a + b.


Note : Below is an example of how a pyramid of 4 rows could be filled.


The answer is 3026.

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.

3 solutions

Steven Yuan
Aug 24, 2017

Relevant wiki: Properties of Binomial Coefficients

Let's represent the bottom-most row of the pyramid by { a 0 , a 1 , a 2 , , a 2016 } , \{a_0, a_1, a_2, \dots, a_{2016}\}, which is a permutation of the first 2017 positive integers. Each integer represents a value in a box.

Let S S be the value in the top-most box. We can find that this value is

S = i = 0 2016 ( 2016 i ) a i = ( 2016 1008 ) a 1008 + i = 0 1007 ( 2016 i ) ( a i + a 2016 i ) . S = \sum_{i = 0}^{2016} \binom{2016}{i}a_i = \binom{2016}{1008}a_{1008} + \sum_{i = 0}^{1007} \binom{2016}{i}(a_i + a_{2016 - i}).

Notice that ( 2016 1008 ) ( 2016 1007 ) ( 2016 1006 ) ( 2016 1 ) ( 2016 0 ) . \binom{2016}{1008} \geq \binom{2016}{1007} \geq \binom{2016}{1006} \geq \cdots \geq \binom{2016}{1} \geq \binom{2016}{0}. Therefore, by the Rearrangement Inequality, the maximum value of S S occurs when

a 1008 = 2017 , { a 1007 , a 1009 } = { 2016 , 2015 } , { a 1006 , a 1010 } = { 2014 , 2013 } , , { a 0 , a 2016 } = { 2 , 1 } , a_{1008} = 2017, \{a_{1007}, a_{1009}\} = \{2016, 2015\}, \{a_{1006}, a_{1010}\} = \{2014, 2013\}, \dots, \{a_{0}, a_{2016}\} = \{2, 1\},

while the minimum value occurs when

a 1008 = 1 , { a 1007 , a 1009 } = { 2 , 3 } , { a 1006 , a 1010 } = { 4 , 5 } , , { a 0 , a 2016 } = { 2016 , 2017 } . a_{1008} = 1, \{a_{1007}, a_{1009}\} = \{2, 3\}, \{a_{1006}, a_{1010}\} = \{4, 5\}, \dots, \{a_{0}, a_{2016}\} = \{2016, 2017\}.

Thus,

M = 2017 ( 2016 1008 ) + ( 2016 + 2015 ) ( 2016 1007 ) + ( 2014 + 2013 ) ( 2016 1006 ) + + ( 2 + 1 ) ( 2016 0 ) m = ( 2016 1008 ) + ( 2 + 3 ) ( 2016 1007 ) + ( 4 + 5 ) ( 2016 1006 ) + + ( 2016 + 2017 ) ( 2016 0 ) . \begin{array}{cccccccccc} M & = & 2017\dbinom{2016}{1008} & + & (2016 + 2015)\dbinom{2016}{1007} & + & (2014 + 2013)\dbinom{2016}{1006} & + & \cdots & + & (2 + 1)\dbinom{2016}{0} \\ m & = & \dbinom{2016}{1008} & + & (2 + 3)\dbinom{2016}{1007} & + & (4 + 5)\dbinom{2016}{1006} & + & \cdots & + & (2016 + 2017)\dbinom{2016}{0}. \\ \end{array}

If we add along each column, notice that we can pair off the coefficients i i and 2018 i 2018 - i to get 2018. We have

M + m = 2018 ( 2016 1008 ) + 2 ( 2018 ) ( 2016 1007 ) + 2 ( 2018 ) ( 2016 1006 ) + + 2 ( 2018 ) ( 2016 0 ) = 2018 ( ( 2016 1008 ) + 2 i = 0 1007 ( 2016 i ) ) = 2018 i = 0 2016 ( 2016 i ) = 2018 × 2 2016 = 1009 × 2 2017 . \begin{aligned} M + m &= 2018\dbinom{2016}{1008} + 2(2018)\dbinom{2016}{1007} + 2(2018)\dbinom{2016}{1006} + \cdots + 2(2018)\dbinom{2016}{0} \\ &= 2018 \left ( \dbinom{2016}{1008} + 2 \sum_{i = 0}^{1007} \dbinom{2016}{i} \right ) \\ &= 2018 \sum_{i = 0}^{2016} \dbinom{2016}{i} \\ &= 2018 \times 2^{2016} \\ &= 1009 \times 2^{2017}. \end{aligned}

Finally, we have a + b = 1009 + 2017 = 3026 . a + b = 1009 + 2017 = \boxed{3026}.

Generalization: For a pyramid with k k rows, if we fill the bottom-most row with the first k k positive integers, the sum of the maximum and minimum possible values of the top-most box will be ( k + 1 ) 2 k 1 . (k + 1)2^{k-1}.

I did exactly the same but I didn't notice the column sum. 😬😁

Ariijit Dey - 3 years, 8 months ago

Note: this is an instance where the "itchy fingers to simplify the expression" actually somewhat backfires.

Calvin Lin Staff - 3 years, 9 months ago

This is a rewrite of my original solution, more thoroughly reasoned per Calvin Lin's wishes.

Let A k A_k with k = 1 , , 2017 k = 1, \dots, 2017 be an arrangement of the numbers { 1 , , 2017 } \{1,\dots, 2017\} in the bottom row of the diagram. Define A k = 2018 A k A'_k = 2018 - A_k ; it is easy to see that A k A'_k is also a valid arrangement of these numbers. I will call these arrangements dual to each other.

I will write Σ A \Sigma A for the value in the top box generated by arrangement A k A_k . It is easy to see that it is a weighted sum: Σ A = k = 1 2017 f k A k \Sigma A = \sum_{k = 1}^{2017} f_kA_k for some constants f k f_k . We do not need the exact values of f k f_k ; the only important thing is that their sum is C = k f k = 2 2016 C = \sum_k f_k = 2^{2016} . This may be seen as follows: each box in the second row from the bottom is the sum of two terms from the bottom row; each box in the third row from the bottom is the sum of four terms from the bottom row; each box in the fourth row from the bottom, the sum of eight terms; and so on, until we reach the 2017th row from the bottom, which is the top box.

The next observation to make is that for two dual arrangements { A k , A k } \{A_k,A'_k\} , Σ A + Σ A = 2018 C \Sigma A + \Sigma A' = 2018C . Proof: Σ A + Σ A = k = 1 2017 f k A k + k = 1 2017 f k ( 2018 A k ) = k = 1 2017 2018 f k = 2018 C . \Sigma A + \Sigma A' = \sum_{k = 1}^{2017} f_kA_k + \sum_{k = 1}^{2017} f_k(2018-A_k) = \sum_{k=1}^{2017} 2018f_k = 2018C.

Now I claim that any arrangement with maximum sum is the dual of an arrangement with minimum sum, and vice versa. We can see that as follows. Suppose that A k A_k is an arrangement with maximum sum, and B k B'_k is an arrangement with minimum sum. Then Σ A = 2018 C Σ A 2018 C Σ B = Σ B \Sigma A' = 2018C - \Sigma A \leq 2018C - \Sigma B = \Sigma B' (because by definition of "maximum", Σ A Σ B \Sigma A \geq \Sigma B ). However, since Σ B \Sigma B' is a minimum, we also have Σ A Σ B \Sigma A' \geq \Sigma B' , and it follows that therefore Σ A = Σ B \Sigma A' = \Sigma B' is also minimal, and Σ B = Σ A \Sigma B = \Sigma A is also maximal.

Finally, then, choosing such a max-min pair of dual arrangements { A k , A k } \{A_k,A'_k\} , we get M + m = Σ A + Σ A = 2018 C = 2018 2 2016 = 1009 2 2017 , M + m = \Sigma A + \Sigma A' = 2018C = 2018\cdot 2^{2016} = 1009\cdot 2^{2017}, making the final answer 3026 \boxed{3026} .

Amazing solution!!!

Carlos Andrés Betancourt Baca - 3 years, 9 months ago

Can you explain the first paragraph in more detail? This isn't immediately obvious to me.

In fact, the solution would have been much better presented by reordering the steps. First show that we can pair up the arrangement. Hence the max and min will have the paired sum.

Calvin Lin Staff - 3 years, 9 months ago

Log in to reply

The key fact is that the value in the top box is a weighed sum of the values in the bottom boxes. (The coefficients A k A_k are actually the binomial coefficients ( 2016 k 1 ) \binom{2016}{k-1} , but that does not matter much.)

If A k A_k is an arrangement of { 1 , 2 , , 2017 } \{1,2,\dots,2017\} with weighed sum S = k f k A k S = \sum_k f_kA_k , then a k = 2018 A k a_k = 2018 - A_k is an arrangement of { 1 , 2 , , 2017 } \{1,2,\dots,2017\} with weighed sum s = ( 2018 f k ) S s = (2018\sum f_k) - S .

Since S + s = constant S + s = \text{constant} , s s is minimal whenever S S is maximal and vice versa.

Arjen Vreugdenhil - 3 years, 9 months ago

Log in to reply

Right, that's my point about the order of the logic presented. It should be:

  1. Observe that the arrangements { A i } \{ A_i \} and { 2018 A i } \{ 2018 - A_i \} would yield the same total sum.
  2. Hence, if S S maximizes the sum, then the minimum is "this constant - S" (and vice versa).

Point 2 isn't obvious without point 1. IE Why if { a i } \{ a_i \} yields the maximum then { 2018 a i } \{ 2018 - a_i \} yields the minimum? Especially since there are numerous ways to achieve this "minimum value", so how do we know that we couldn't do better?

Calvin Lin Staff - 3 years, 9 months ago

Log in to reply

@Calvin Lin Call two arrangements A i A_i and A i = 2018 A i A'_i = 2018 - A_i dual arrangements.

Given any pair of dual arrangements, the corresponding sums Σ A \Sigma A and Σ A \Sigma A' satisfy Σ A + Σ A = C , \Sigma A + \Sigma A' = C, where C = 2018 k f k = 2018 2 2016 C = 2018\sum_k f_k = 2018\cdot 2^{2016} .

My claim is that if an arragement has maximum sum M M , then its dual necessarily has minimum sum m m .

Suppose this was not true. I.e. there is a pair of dual arrangements { A , A } \{A,A'\} such that A A has maximal sum but A A' does not have minimal sum. Then there exists a different pair of dual arrangements { B , B } \{B,B'\} such that B B' has minimal sum, and Σ B < Σ A \Sigma B' < \Sigma A' . But then Σ B = C Σ B > C Σ A = Σ A ; \Sigma B = C - \Sigma B' > C - \Sigma A' = \Sigma A; but then arragement B B would produce a greater sum than arragement A A , contrary to our assumption that A A has maximum sum. Therefore when A A is maximal, the dual arrangement A A' is necessarily minimal. The converse is proven in the same way.

Arjen Vreugdenhil - 3 years, 9 months ago

Log in to reply

@Arjen Vreugdenhil Yes, I am in agreement with you.

What I'm saying is that point 2 is hard to prove without explicitly using point 1. As such, in the presentation of the solution, we would ideally present point 1 as a lemma first (which is what you have done in the comment, but not in the solution).

Calvin Lin Staff - 3 years, 9 months ago

Log in to reply

@Calvin Lin I will update my solution by filling in the details :)

Arjen Vreugdenhil - 3 years, 9 months ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# https://brilliant.org/weekly-problems/2017-09-04/advanced/?p=4

def row_calculator(x):    
    y = []
    while len(x) > 1:
        #print x
        for k,i in enumerate(x[:-1]):
            y.append(x[k]+x[k+1])
        x = y
        y = []
    #print x
    return x

def powers(n):
    return len([2**p for p,v in enumerate(bin(n)[:1:-1])])-1

def gcd(*numbers):
    """Return the greatest common divisor of the given integers"""
    from fractions import gcd
    return reduce(gcd, numbers)
#-----------------------------------------------------------------------
max_boxes = 2017 # <----------------------------------enter number of boxes in bottom row
x = range(1,max_boxes+1)

if max_boxes%2 == 1: 
    max_row = x[1::2]+x[-1::-2]
    min_row = x[-2::-2]+x[-1::-2][::-1]
else:
    max_row = x[-2::-2][::-1]+x[-1::-2]
    min_row = x[-2::-2]+x[-1::-2][::-1]

y = max_boxes+1 
tot = (row_calculator(max_row)[0]+row_calculator(min_row)[0])/y

z = powers(tot)
while gcd(y,z)>1:
    y = y/2
    z += 1
print '%d x 2**%d' % (y, z)
print '%d + %d = %d' % (y, z, y+z)

1
2
1009 x 2**2017
1009 + 2017 = 3026

Michael Fitzgerald - 3 years, 3 months ago

A pythonic solution

Michael Fitzgerald - 3 years, 3 months ago
Kevin Tong
Sep 9, 2017

When we form one of these pyramids, the maximum value obtainable when going through the process is obtained when the middle number(s) (depending on whether the number at the bottom is even or odd) are maximized. Similarly, the minimum value is obtained when the middle number(s) is minimized. This is because as we go up the pyramid, the middle numbers expand outward and are added with the most numbers, affecting the outcome the most. Through some testing with smaller numbers, we can get a set of coordinate points, with x x being the largest number at the bottom and y y being M + m M+m : ( 2 , 3 + 3 ) ; ( 3 , 7 + 9 ) ; ( 4 , 16 + 24 ) (2, 3+3); (3, 7+9); (4, 16+24) . Comparing the y values to the equation given in the question, we see that the formula for any number is simply ( n + 1 ) 2 n 1 (n+1) \cdot 2^{n-1} . Plugging in our values, we get ( 2017 + 1 ) 2 2017 1 = 2018 2 2016 = 1009 2 2017 a + b = 1009 + 2017 = 3026 (2017+1) \cdot 2^{2017-1}=2018 \cdot 2^{2016} = 1009 \cdot 2^{2017} \implies a+b=1009+2017=\boxed{3026} . I know this was kind of a cheating strategy using the given equation. The complete way to go about solving this would use combinatorics, which I was too lazy to use.

To see the combinatorics answer, Steven Yuan has a great explanation for it.

Kevin Tong - 3 years, 9 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...