AndreiBalanici's blog

By AndreiBalanici, history, 4 years ago, In English

Partitioning a natural number n in order to get the maximum product sequence of its addends.Do anyone have informations about this problem?

  • Vote: I like it
  • +2
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Pseudocode (assume $$$n \geq 2$$$)

if (n % 3 == 0) {
  [print n/3 '3']
} else if (n % 3 == 1) {
  [print (n/3 - 1) '3' and a '4']
} else {
  [print n/3 '3' and a '2']
}