from pyx import * from ent import * from math import * #fibonacci table fibs = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352] n = 10000 #recursive compute nfib(n). This is Sloane sequence A0000119 def nfib(n): fibindex = 0 for i in fibs: if i<=n: fibindex = fibindex+1 fibindex -= 1 fibi = fibs[fibindex] k = n - fibi if n>=0 and n<=2: return 1 elif n>2 and k>=0 and k2 and k>=fibs[fibindex-3] and k