← RoseCode

ROSECODE 160

Quasi-perfect numbers

Philippe_57721 · Programming ·

An integer is perfect if it is equal to the sum of its proper divisors.

Let say an integer is quasi-perfect if it can be written as a sum of some distinct of its proper divisors

For instance, N = 150 as the following proper divisors:
1,2,3,5,6,10,15,25,30,50,75
and can be written as:
  • 1 + 3 + 5 + 6 + 10 + 50 + 75
  • 1 + 3 + 6 + 10 + 25 + 30 + 75
  • 1 + 3 + 6 + 15 + 50 + 75
  • 2 + 3 + 5 + 10 + 25 + 30 + 75
  • 2 + 3 + 5 + 15 + 50 + 75
  • 2 + 3 + 15 + 25 + 30 + 75
  • 5 + 15 + 25 + 30 + 75
  • 10 + 15 + 50 + 75
  • 25 + 50 + 75

Find the first such decomposition for 1000768 (in lexicographic order):

Answer format: comma separated list of divisors in ascending order.

Example: 1,3,5,6,10,50,75

[My timing : 50 sec]