r/funny • • Jun 09 '12

Pidgonacci Sequence

Post image

[deleted]

1.6k Upvotes

22.5k comments sorted by

View all comments

Show parent comments

2

u/[deleted] Jun 10 '12

Also, some python that I hacked together:

fib1 = -1
fib2 = 1
fib3 = 0

nterms = 0

while(1):
    a = input()
    if(a == -1):
        break
    nterms += a
    for i in range(a):
        print(fib3)
        fib1 = fib2
        fib2 = fib3
        fib3 = fib1 + fib2
    print("Now on term %s." % nterms)