tozeck(n) = { for (i=0, oo, if (n<=fibonacci(2+i), my (v=0, f); forstep (j=i, 0, -1, if (n>=f=fibonacci(2+j), n-=f; v+=2^j; ); if (n==0, return (v); ); ); ); ); } fromzeck(n) = { my (v=0, j); while (n, n-=2^j=valuation(n,2); v+=fibonacci(2+j); ); return (v); } row(n) = { my (z = tozeck(n), r = [0], b); while (z, z-=b = 2^valuation(z, 2); r=concat(r, [v+b | v <- r]); ); apply(fromzeck, r); } { m = -1; for (n=0, fibonacci(15), r = row(n); apply (v -> print (m++ " " v), r); ); }