OFFSET
1,3
COMMENTS
Locates patterns of the form 0x1 or 1x0 in the Thue-Morse sequence.
Also union of sequences {A079523(n)-k}, k=0 or 1. For a generalization see A161890. - Vladimir Shevelev, Jul 05 2009
The asymptotic density of this sequence is 2/3 (Rowland and Yassawi, 2015; Burns, 2016). - Amiram Eldar, Jan 30 2021
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..10000
Rob Burns, Asymptotic density of Motzkin numbers modulo small primes, arXiv:1611.04910 [math.NT], 2016.
Eric Rowland and Reem Yassawi, Automatic congruences for diagonals of rational functions, Journal de Théorie des Nombres de Bordeaux, Vol. 27, No. 1 (2015), pp. 245-288.
MATHEMATICA
tm[0] = 0; tm[n_?EvenQ] := tm[n] = tm[n/2]; tm[n_] := tm[n] = 1 - tm[(n - 1)/2]; Reap[For[n = 0, n <= 6000, n++, If[tm[n] + tm[n + 2] == 1, Sow[n]]]][[2, 1]] (* G. C. Greubel, Jan 05 2018 *)
Flatten[Position[Partition[ThueMorse[Range[0, 120]], 3, 1], _?(#[[1]]+#[[3]] == 1&), 1, Heads->False]]-1 (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 29 2019 *)
PROG
(PARI) is(n)=hammingweight(n)%2!=hammingweight(n+2)%2 \\ Charles R Greathouse IV, Aug 20 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vladimir Shevelev, Jun 16 2009
EXTENSIONS
Extended by R. J. Mathar, Aug 28 2009
STATUS
approved