login
A114375
a(n) = (a(n-1) XOR a(n-2)) + 1, a(0) = a(1) = 0.
6
0, 0, 1, 2, 4, 7, 4, 4, 1, 6, 8, 15, 8, 8, 1, 10, 12, 7, 12, 12, 1, 14, 16, 31, 16, 16, 1, 18, 20, 7, 20, 20, 1, 22, 24, 15, 24, 24, 1, 26, 28, 7, 28, 28, 1, 30, 32, 63, 32, 32, 1, 34, 36, 7, 36, 36, 1, 38, 40, 15, 40, 40, 1, 42, 44, 7, 44, 44, 1, 46, 48, 31, 48, 48, 1, 50, 52, 7, 52, 52, 1
OFFSET
0,4
COMMENTS
The function moving to the next overlapping pair in the sequence is f:(i,j) = (j, (i XOR j) + 1) is one-to one. This means that the only possible trajectories for the sequence are loops, "lines", and "rays". The inverse is f^{-1}: (i,j) = (i XOR (j-1), i) is defined except when j = 0. Thus the only infinite non-repeating trajectories are those starting with (i,0) for some i. If we define the size of a pair (i,j) to be the largest power of two <= max(i,j). It is trivial to see that the size of f(i,j) is always >= the size of (i,j). Coupled with the fact there are only finitely many pairs with a given size, this means that "line" trajectories are not possible. Any trajectory that goes to a larger size must be part of a ray, so that tracing back will eventually reach zero. - Franklin T. Adams-Watters, Mar 03 2014
LINKS
FORMULA
a(3n)=2n. a(3n+1)=4*floor((n+1)/2). a(6n+2)=1. a(6n+5)=2^(A001511(n+1)+2)-1.
a(3*n + 1) = A168273(n+1). a(3*n - 1) = A074723(n) - 1.- Michael Somos, Mar 03 2014
a(-n) = -a(n) if n == 0 (mod 3), a(-1-n) = -a(n) if n == 1 (mod 3), a(-2-n) = a(n) if n == 2 (mod 3). - Michael Somos, Mar 03 2014
EXAMPLE
G.f. = x^2 + 2*x^3 + 4*x^4 + 7*x^5 + 4*x^6 + 4*x^7 + x^8 + 6*x^9 + 8*x^10 + ...
MATHEMATICA
a[ n_] := If[ n < 0, BitXor[ a[n + 1], a[n + 2] - 1], If[n < 2, 0, 1 + BitXor[ a[n - 1], a[n - 2]]]]; (* Michael Somos, Mar 03 2014 *)
a[ n_] := If[ Mod[n, 3] == 0, 2 n/3, If[ Mod[n, 3] == 1, 4 Quotient[n + 3, 6], If[ n == -1, -1, 2^IntegerExponent[ Fibonacci[n + 1], 2] - 1]]]; (* Michael Somos, Mar 03 2014 *)
nxt[{a_, b_}]:={b, BitXor[a, b]+1}; NestList[nxt, {0, 0}, 80][[All, 1]] (* Harvey P. Dale, Feb 26 2020 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved