A334173 Least i such that i-th term of Thue-Morse sequence (A010060) differs from (i + n)-th term.
0, 0, 2, 0, 1, 4, 0, 0, 1, 2, 0, 8, 0, 0, 2, 0, 1, 2, 0, 4, 0, 0, 1, 16, 0, 0, 2, 0, 1, 4, 0, 0, 1, 2, 0, 4, 0, 0, 1, 8, 0, 0, 2, 0, 1, 2, 0, 32, 0, 0, 2, 0, 1, 4, 0, 0, 1, 2, 0, 8, 0, 0, 2, 0, 1, 2, 0, 4, 0, 0, 1, 8, 0, 0, 2, 0, 1, 2, 0, 16, 0, 0, 2, 0, 1, 4
Offset: 1
Examples
The first few terms of the Thue-Morse sequence are: 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0... . Note that the Thue-Morse sequence has offset 0. For n = 1, we see that the least i such that i and i + n index different terms is i = 0. Hence a(1) = 0. For n = 2, the least i such that i and i + n index different terms is also i = 0. Hence a(2) = 0. For n = 3, i = 0 won't work because Thue-Morse(0) and Thue-Morse(3) are both 0. Nor will i = 1 do because Thue-Morse(1) and Thue-Morse(4) are both 1. With i = 2, we see that Thue-Morse(2) = 1 and Thue-Morse(5) = 0. Hence a(3) = 0.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Array[Block[{i = 0}, While[ThueMorse[i] == ThueMorse[i + #], i++]; i] &, 86] (* Michael De Vlieger, Jun 27 2020 *)
-
PARI
a(n)=if(n<3,return(0)); my(k); if(n%2==0, k=valuation(n,2); return(a(n>>k)<
>2)); \\ Charles R Greathouse IV, Apr 18 2020 -
PARI
a(n) = if(hammingweight(n)%2,0, my(k=valuation(n,2)); 1 << (k + (valuation((n>>k)+1,2)%2==0))); \\ Kevin Ryde, Apr 27 2020
Comments