
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The number of nice divisors is equal to the product of the count of each prime factor. Then the problem is reduced to: given n, find a sequence of numbers whose sum equals n and whose product is maximized.
This sequence can have no numbers that are larger than 4. Proof: if it contains a number x that is larger than 4, then you can replace x with floor(x/2) and ceil(x/2), and floor(x/2) * ceil(x/2) > x. You can also replace 4s with two 2s. Hence, there will always be optimal solutions with only 2s and 3s.
If there are three 2s, you can replace them with two 3s to get a better product. Hence, you'll never have more than two 2s.
Keep adding 3s as long as n ≥ 5.