Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum product of coprime factors

Tags:

algorithm

math

I essentially have a problem which boils down to the following: Given some (integer) number n, find a set of coprime numbers, say c = (c1, c2, ..., ck), each less than n, which satisfy:

1) The product of all ci is maximal.

2) The sum of all ci is equal to n.

This may end up being a question for MathOverflow, but is there any kind of non-brute force algorithm for doing this?

like image 401
Yuushi Avatar asked Feb 03 '12 04:02

Yuushi


1 Answers

You're basically looking for the maximal least common multiple of any partition of n. The product is known as Landau's function (see OEIS A000793). This can be computed using dynamic programming, see here.

like image 73
DSM Avatar answered Sep 28 '22 11:09

DSM