# Partition a number $n$ in exactly sum of $k$ distinct numbers such that product of the numbers should be maximum.

The question is to partition a given number $$n$$ in exactly sum of $$k$$ distinct positive numbers such that the product of $$k$$ distinct number become maximum. $$k$$ will be given optimally so that it will be possible to partition.

For example:

1-$$n$$=5 and $$k$$ =2 partitions are {1,5} and {2,3} so answer will be max(1*5,2*3) i.e equal to 6.

2-$$n$$=6 and $$k$$=2 partitions will be {5,1} and {4,2} answer will be 8.

3-$$n$$=7 and $$k$$=3 partition will be {1,3,4} and {1,4,2} answer will be max(1*3*4,1*4*2) i.e equal to 12. Please help.Thanks in advance.

• – Lord Shark the Unknown Oct 28 '18 at 5:56
• Thank you for the advice. Will follow in future. – Paul Jay Oct 28 '18 at 5:59
• Basically you need to make them as close to $n/k$ as possible – T_M Oct 28 '18 at 6:14
• Yes, but how can I chose the number after then.Rest of the k-1 distinct number. – Paul Jay Oct 28 '18 at 6:16
• Note that $1+3+4=8$ – Mark Bennet Oct 28 '18 at 6:27