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

for (n=0, 2^13-1, print (n " " a(n)))

quit