← RoseCode

ROSECODE 520

Fibonacci Partitions Revisited

Philippe_57721 · Programming ·

Let F={1,2,3,5,8,13,21,34,55,} the sequence of distinct Fibonacci numbers.

The number 1000 can be decomposed in 15 ways as a sum of elements of F
  • 5,14
  • 3,4,14
  • 5,12,13
  • 1,2,4,14
  • 3,4,12,13
  • 5,10,11,13
  • 1,2,4,12,13
  • 3,4,10,11,13
  • 5,8,9,11,13
  • 1,2,4,10,11,13
  • 3,4,8,9,11,13
  • 5,6,7,9,11,13
  • 1,2,4,8,9,11,13
  • 3,4,6,7,9,11,13
  • 1,2,4,6,7,9,11,13
For each decomposition, we give the indexes in F (0-origin):
{5,12,13}1000=F5+F12+F13=13+377+610

Find the number of decompositions of 1234568 and give the middle one (if there is n decompositions, give the decomposition n/2.
The 1st one has index 0.
The decompositions are sorted by length, then lexicographically.

Answer format: count / (comma delimited list of indexes)

You are given : 15/3,4,10,11,13 for n=1000

[My timing: 50 sec]