Question: Zeckendorf's Theoreme

How to find all occurrences with Fibonacchi numbers?
100=89+8+2+1=89+5+3+1=55+34+8+2+1 etc...

fib := proc(n::nonnegint) option remember; if n <= 1 then n; else fib(n - 1) + fib(n - 2); end if; end proc;
zeck := proc(n::posint) local k, d; k := 2; while fib(k) <= n do k := k + 1; end do; d := n - fib(k - 1); if d = 0 then k - 1; else k - 1, zeck(d); end if; end proc;
zeck(100);
E := [fib(11), fib(6), fib(4)]; add(E[i], i = 1 .. nops(E));

Please Wait...