"""
[0, 1, 2, 2, 4, 6, 8, 9, -31] generates [1, 2, 3, 4, 6, 8, 10, 12, 15] as a Fibonacci sequence
sum([0, 1, 2, 2, 4, 6, 8, 9, -31]) =  1
sum([1, 2, 2, 4, 6, 8, 9, -31, 1]) =  2
sum([2, 2, 4, 6, 8, 9, -31, 1, 2]) =  3
sum([2, 4, 6, 8, 9, -31, 1, 2, 3]) =  4
sum([4, 6, 8, 9, -31, 1, 2, 3, 4]) =  6
sum([6, 8, 9, -31, 1, 2, 3, 4, 6]) =  8
sum([8, 9, -31, 1, 2, 3, 4, 6, 8]) =  10
sum([9, -31, 1, 2, 3, 4, 6, 8, 10]) =  12
sum([-31, 1, 2, 3, 4, 6, 8, 10, 12]) =  15
sum([1, 2, 3, 4, 6, 8, 10, 12, 15]) =  61
sum([2, 3, 4, 6, 8, 10, 12, 15, 61]) =  121
sum([3, 4, 6, 8, 10, 12, 15, 61, 121]) =  240
sum([4, 6, 8, 10, 12, 15, 61, 121, 240]) =  477
sum([6, 8, 10, 12, 15, 61, 121, 240, 477]) =  950
sum([8, 10, 12, 15, 61, 121, 240, 477, 950]) =  1894
sum([10, 12, 15, 61, 121, 240, 477, 950, 1894]) =  3780
sum([12, 15, 61, 121, 240, 477, 950, 1894, 3780]) =  7550
sum([15, 61, 121, 240, 477, 950, 1894, 3780, 7550]) =  15088
sum([61, 121, 240, 477, 950, 1894, 3780, 7550, 15088]) =  30161
sum([121, 240, 477, 950, 1894, 3780, 7550, 15088, 30161]) =  60261
"""

os = [1, 2, 3, 4, 6, 8, 10, 12, 15]

s = os

for i in range(0, len(os)):
    s = [s[-i-1] - sum(s[0:-i-1])] + s

seed = s[0:len(os)]

print(seed, "generates", os, "as a Fibonacci sequence")

for i in range(0, 20):
    term = sum(seed)
    print(f"sum({seed}) = ", term)
    seed = seed[1:] + [term]
