OFFSET
0,2
COMMENTS
Counts cycles of the prefix-XOR operator on GF(2)^n (conjugate to Gray code). The formula is a direct expansion of the recurrence a(n+1) = a(n) + 2^n/C_n. - Laurent Neau, Jan 16 2026
LINKS
Laurent Neau, Table of n, a(n) for n = 0..1000
J. Culberson, Mutation-Crossover Isomorphisms and the Construction of Discriminating Functions, Evolutionary Computation 2(3): 279-311, (1994).
Laurent Neau, Algebraic proof of closed-form formula, Jan 2026.
J. A. Oteo and J. Ros, A Fractal Set from the Binary Reflected Gray Code, J. Phys. A: Math Gen. 38 (2005) 8935-8949.
FORMULA
a(n) = 2^(n-L-1) + Sum_{k=0..L} 2^(2^k-k-1) where L = floor(log_2(n)). - Laurent Neau, Jan 16 2026
PROG
(PARI) f(n) = 2^(n-1-log(n+.5)\log(2)) \\ A054243
a(n) = if (n<=1, n+1, a(n-1) + f(n-1));
(PARI) a(n) = if(n==0, 1, my(L=logint(n, 2)); 1<<(n-L-1) + sum(k=0, L, 1<<bitneg(k, k))); \\ Kevin Ryde, Jan 24 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Joe Culberson (joe(AT)cs.ualberta.ca)
STATUS
approved
