# Find $max(\prod{a_i})$ given that $\sum a_i=2017$ for $n$ number of positive integers from $a_1, a_2, \cdots, a_n$

Find the maximum value of $(\prod{a_i})$ given that $\sum a_i=2017$ for $n$ number of positive integers from $a_1, a_2, \cdots, a_n$

I don't understand how to do it. I had thought of proceeding by AM-GM and got to the conclusion that $\bigg(\frac{2017}{n}\bigg)^n \geq a_1a_2 \cdots a_n$ and then we can check how the function (LHS) increases and work on that. But I can't do it.

May I get some help?

• If any of $a_i$ is bigger than $4$, then we can make the product even bigger by replacing it with $2$ and $a_i-2$. What can you get about $2, 3, 4$? EDIT: Oh, I overlooked that $n$ is fixed number. One thing to note is that $a_i$s should not differ more than 2. – didgogns May 5 '17 at 14:00
• Check out the solution given here: math.stackexchange.com/questions/1571526/… – Brenton May 5 '17 at 14:04
• @Brenton I did see the link but that doesn't satisfy my answer properly I feel. It basically says that all terms have to be equal. But I have mentioned that $n$ is not fixed. Whoever attempts to solve the problem has the free will to find out the $n$. The question wants to know the value of $a_1a_2 \cdots a_n$ – Mathejunior May 5 '17 at 14:09
• This looks very similar: math.stackexchange.com/questions/2171746/… – Martin R May 5 '17 at 14:39
• I was about to post an answer, but the Q is not clear. Are$a_1,...,a_n$ required to be $n$ distinct values? Or are duplicates allowed? – DanielWainfleet May 6 '17 at 7:30

If $a_j\geq 2+a_i$ for some $j,i$ then the product is not maximal. For we can replace $a_j$ and $a_i$ with $a'_j=a_j-1$ and $a'_i=a_i+1.$ Then $a'_j+a'_i=a_j+a_i$, but $a'_ja'_i=(a_j-1)(a_i+1)=a_ja_i+(a_j-a_i)-1\geq a_ja_i+2-1>a_ja_i.$
Let $2017=nM+r$ with non-negative integers $M, r$ with $0\leq r\leq n-1.$ Let $A_i=M$ for $i\leq n-r$ and let $A_i=M+1$ for $n-r+1\leq i\leq n.$ This is the only way, up to permutations, to have a sequence of $n$ (not necessarily) distinct) positive integers add to $2017,$ such that the absolute difference between any two of them is at most $1.$