Inspired by Romain Bouchard

Algebra Level 3

Let a 1 , a 2 , . . . , a n a_1,a_2,...,a_n be distinct positive integers such that a 1 + a 2 + + a n = 2018. a_1+a_2+\cdots+a_n=2018.

Find the maximum value of a 1 × a 2 × × a n . a_1\times a_2\times \cdots \times a_n.

If this is equal to a ! b \frac{a!}{b} , where a a and b b are distinct positive integers and a + b a+b is minimized, write your answer as a b 2 . \frac{ab}{2}.


The answer is 1952.

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

Mark Hennings
Mar 9, 2018

Call a collection A = ( a 1 , a 2 , . . . , a n ) A = (a_1,a_2,...,a_n) of distinct positive integers such that a 1 < a 2 < < a n a_1 < a_2 < \cdots < a_n and a 1 + a 2 + + a n = 2018 a_1 + a_2 +\cdots + a_n = 2018 a viable collection. If A A is a viable collection, let P ( A ) = a 1 a 2 a n P(A) = a_1a_2 \cdots a_n be the product of its elements. Note that 2 ( n 2 ) > n 2(n-2) > n for n > 4 n > 4 and that ( b 1 ) ( a + 1 ) > a b (b-1)(a+1) > ab and a + 1 < b 1 a+1 < b-1 for b > a + 2 b > a + 2 .

  • If A A is a viable collection with a 1 = 1 a_1=1 , then the collection A ^ \hat{A} obtained by removing a 1 = 1 a_1=1 and replacing a n a_n with a n + 1 a_n+1 is another viable collection with P ( A ^ ) > P ( A ) P(\hat{A}) > P(A) .
  • If A A is a viable collection with a 1 5 a_1 \ge 5 , then the collection A ^ \hat{A} obtained by replacing a 1 a_1 with 2 2 and a 1 2 a_1-2 is another viable collection with P ( A ^ ) > P ( A ) P(\hat{A}) > P(A) .
  • If A A is a viable collection, and there exists 1 u < n 1 \le u < n for which a u + 1 > a u + 2 a_{u+1} > a_u + 2 , then the collection A ^ \hat{A} obtained by replacing a u a_u and a u + 1 a_{u+1} with a u + 1 a_u+1 and a u + 1 1 a_{u+1}-1 is another viable collection with P ( A ^ ) > P ( A ) P(\hat{A}) > P(A) .
  • If A A is a viable collection, and there exists 1 u < v < n 1 \le u < v < n for which a u + 1 = a u + 2 a_{u+1} = a_u+2 and a v + 1 = a v + 2 a_{v+1} = a_v+2 , then the collection A ^ \hat{A} obtained by replacing a u a_u and a v + 1 a_{v+1} with a u + 1 a_u+1 and a v + 1 1 a_{v+1}-1 is another viable collection with P ( A ^ ) > P ( A ) P(\hat{A}) > P(A) .

Thus, if A A is a viable collection with the largest possible value of P ( A ) P(A) , then the smallest integer is 2 2 , 3 3 or 4 4 , and the integers will be consecutive, except that at most one pair of neighbouring integers can differ by 2 2 . There are three such collections:

  • 2 , 3 , . . . , 60 , 62 , 63 , 64 2,3,...,60,62,63,64 (start with 2 2 and omit 61 61 ) has product 64 ! 61 \tfrac{64!}{61} .
  • 3 , 4 , . . . , 58 , 60 , 61 , 62 , 63 , 64 3,4,...,58,60,61,62,63,64 (start with 3 3 and omit 59 59 ) has product 64 ! 2 × 59 \tfrac{64!}{2 \times 59} .
  • 4 , 5 , . . . , 55 , 57 , 58 , 59 , 60 , 61 , 62 , 63 , 64 4,5,...,55,57,58,59,60,61,62,63,64 (start with 4 4 and omit 56 56 ) has product 64 ! 6 × 56 \tfrac{64!}{6 \times 56} .

The first of these has the largest product. This makes the answer 1 2 × 64 × 61 = 1952 \tfrac12 \times 64 \times 61 = \boxed{1952} .

Nice solution!

Steven Jim - 3 years, 3 months ago

I didn't consider dropping the 1, so I wound up with 64!/62. Irritatingly close.

Binky MH - 3 years, 2 months ago

Log in to reply

Good luck next time :)

Steven Jim - 3 years, 2 months ago

Damn Close.

Aniruddha Bagchi - 3 years, 2 months ago

Same here! :(

Lee Isaac - 3 years, 2 months ago

Log in to reply

Lol everyone makes the same mistake, this might be why only 16% got this right :)

Steven Jim - 3 years, 2 months ago

Amazing solution. I was trying to use calculus. It lead to a disaster.

Srikanth Tupurani - 3 years, 2 months ago

How did you get the idea? This is very similar to some numerical methods to find the solution. We start with some arbitrary point and try to move towards the solution. Here we have set some rules. That is given some solution how to modify it to get a better solution. What changes on a given solution will make it a better solution. These problems can be solved only if someone breaks his head to understand each and every step of the solution deeply. It is like analysing very deeply. Inspite of all this analysis. There will be some problem which is totally different and needs news ideas.

Srikanth Tupurani - 3 years, 2 months ago

Log in to reply

This proof is a small variation of the much more standard one (where the integers in the collection do not need to be distinct). The idea is that there are only finitely many viable collections of integers, and hence there must be a largest possible product. We then identify properties that a viable collection must have if it is to give this largest product. If successful, these properties result in only a finite number of possibilities, that can simply be checked to see what the biggest product is.

Mark Hennings - 3 years, 2 months ago

Log in to reply

Excellent solution. I tried to use calculus. A similar problem was asked long back. I succeeded in solving it using calculus. But in this case calculus does not work. As you said the main hint is that there are finitely many viable collections of integers.

Regarding optimisation discrete optimisation problem is much tougher. I thought of solving it using the method of extending the function. Suppose we are given a polynomial function f:N ->N with integer coefficients, where N Is the set of natural numbers. Suppose we are asked to find the maximum and minimum value of the function. One method is to extend the function to the set of real numbers. Now we study the extended function F:R->R. Where R is the set of real numbers. F is nothing but the polynomial function which when restricted to N equals the function f. We can study the behaviour of F to understand the behaviour of f. This is an idea which is exploited in studying the convergence of sequences like 1+1/2+1/3.......+1/n. The more civilised the functions the more easier to understand the places where it attains maxima and minima. Overcivilised functions like polynomials are easier to handle. This method can be applied to any function f:N ->R. Provided the function f is a civilised function. In this problem using this idea is a disaster. Thanks for the nice solution.

Srikanth Tupurani - 3 years, 2 months ago

Since all values must be positive any value must be <=2018 and 64(64+1)/2>2018 so that your n<64, noticing that the in the inital question has yet "finitely many viable collections" so that you could initialy "check them all". But I know what you meant.

Pau Cantos - 3 years, 2 months ago

Ones we realise that the largest value of n such that. 1+2+ ......+n is close to 2018 is 63. It gives so much relief. We are at least clear the solution is closer to this one. Thanks for the solution. We have learn a new technique callled perturbation.

Srikanth Tupurani - 3 years, 2 months ago

Nice solution! I spent who-knows-how-long fiddling around with series and triangular numbers before blindly stumbling upon the answer. This was a really fun problem to work through though.

Sam Stewart - 3 years, 2 months ago

Log in to reply

Lol thanks :D

Steven Jim - 3 years, 2 months ago

Honestly, engineering and mathematics have taught me nothing. Either that, or I'm just stupid. Period. Two weeks' puzzles, zero right...

Gerrit Grundling - 3 years, 1 month ago

Log in to reply

It teaches you a lot, just that it's not applicable to these kinds of math.

And nope, you are not stupid. A lot got this incorrect (1076 until now)

Steven Jim - 3 years, 1 month ago

Engineering would teach you that without a strong motivation, a problem like this is simply NOT worth the effort. It's nice to know that someone can do math at this level, but I've never needed it in a chemical career. (Other hard problems, yes -- if we NEEDED to.) It's nice to see some of these exotic problems and read the exotic solutions, but I don't need to fret through them. I do need to rake the front yard, when though I understood it when I was 4.

Getting too frustrated by these problems is unhealthy for your mind, G e r r I t. (Autocorrect!) Don't hurt your pride! It would be stupid to let entertainment cause you real pain.

I do Sudoku every day except Friday. The problems are worth the 15 minutes after breakfast while I finish my coffee. I'm NOT throwing two hours away to get the Level 4 once a week. Time's up? Throw it away! I get about one in eight anyway ...

Bill Weihmiller - 3 years, 1 month 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
41
42
43
44
45
# https://brilliant.org/weekly-problems/2018-04-02/advanced/?p=5
import copy
from functools import reduce
import math

def comp_lists(a,b):
    return reduce(lambda b1,b2: b1 and b2, map(lambda e1,e2: e1==e2, sorted(a), sorted(b)), True)

def combinations(target, data):
    if not comp_lists(target, max_range):
        for i in range(len(data)):
            new_target = copy.copy(target)
            new_data = copy.copy(data)
            new_target.append(data[i])
            new_data = data[i+1:]            
            if sum(new_target) == numb:
                nums_product = reduce( (lambda x, y: x * y), new_target)
                if nums_product < min(min_product.keys()):
                    min_product[nums_product] = new_target  
                if nums_product > max(max_product.keys()):
                    max_product[nums_product] = new_target    
            combinations(new_target, new_data)
    else:       
        x = [(key, val) for key,val in max_product.iteritems() if key == max(max_product.keys())]
        y = list(set(range_).difference(set(x[0][1])))
        if 1 in y: y.remove(1)
        y = '%d!/(%s)' % (max(range_), '.'.join(str(i) for i in y))
        print 'Max. Product = %d;\tDistinct pos. ints. = %s (Length/Max.Length = %d/%d);\t\t%s' \
            % (x[0][0], x[0][1], len(x[0][1]), len(sorted(max_product.values(), key=len)[-1]), y)
        x = [(key, val) for key,val in min_product.iteritems() if key == min(min_product.keys())]
        y = list(set(range_).difference(set(x[0][1])))
        if 1 in y: y.remove(1)
        y = '%d!/(%s)' % (max(range_), '.'.join(str(i) for i in y))
        print 'Min. Product = %d;\tDistinct pos. ints. = %s (Length/Max.Length = %d/%d);\t\t%s' \
            % (x[0][0], x[0][1], len(x[0][1]), len(sorted(min_product.values(), key=len)[-1]), y)

max_int = 12  # <------distinct positive integers ex( 1,2,3...,10)
numb = 60   # <-------distinct positive integers from range above totalling)
print 'Distinct positive integers totalling %d' % numb
max_product = {0:[]}
min_product = {math.isinf:[]}
range_ = range(1,max_int+1)   
max_range = [max(range_)]  
target = []
combinations(target, range_)

1
2
3
Distinct positive integers totalling 60
Max. Product = 7983360; Distinct pos. ints. = [2, 3, 4, 6, 7, 8, 9, 10, 11] (Length/Max.Length = 9/10);         12!/(12.5)
Min. Product = 1330560; Distinct pos. ints. = [1, 2, 7, 8, 9, 10, 11, 12] (Length/Max.Length = 8/10);           12!/(3.4.5.6)

Michael Fitzgerald - 3 years, 1 month ago

Script to calculate a!/b for set of distinct positive integers totaling X. Obviously 64! is out of range

Michael Fitzgerald - 3 years, 1 month ago

Log in to reply

What do you mean?

Steven Jim - 3 years, 1 month ago

Log in to reply

"Obviously 64! is out of range " I mean for the script

Michael Fitzgerald - 3 years, 1 month ago

I got another way of solving it, probably more intuitive. I proved that more the number of sums, more will be the product value (let me know if you find it difficult). Then I proved that closer the numbers to each other, more will be the product of them. I ended up with 63 and 64 where the sum is 2 less than, and 62 more than 2018 (sum implies summing natural numbers from 1 to 63 or 64). I tried adding 2 (add 1 to 62 and 1 to 63) and in other case subtract 62 (remove 1 and 61). :)

Rishabh Bhardwaj - 3 years, 1 month ago

Log in to reply

Well, my proof is doing all these things (that the lowest value is less than 5 and there are few non consecutive numbers is showing that the number involved will be as many as possible, for example). What we need is to see the details of each of the stages of your proof.

Mark Hennings - 3 years, 1 month ago

Log in to reply

Hi Mark! I am not a mathematician (just a learner ;) ), so it's really difficult for me (or someone like me) to follow the solution.

Rishabh Bhardwaj - 3 years, 1 month ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...