A340399(n) = for (i=1, oo, my (f=fibonacci(i)); if (f>=2^n, return (f))) a(n) = { my (v=0); while (n, my (x=#binary(n)-1); v+=2^x; n=bitxor(n, A340399(x)); ); return (v); } for (n=0, 2^13-1, print (n " " a(n))) quit