OFFSET
1,2
COMMENTS
Sequence is S(infinity) where S(1)={1,2} and S(n+1)=S(n)S'(n) where S'(n) is obtained from S(n) by substituting an element x of S(n) with M(n)-x where M(n)=2+Max{S(n)}.
For comparison, the Thue-Morse sequence on alphabet {1,2} is constructed as follows: S(1)={1,2} and S(n+1)=S(n)S'(n) where S'(n) is obtained from S(n) by substituting an element x of S(n) with 3-x.
FORMULA
Sum_{k=1..n} a(k) is asymptotic to C*n*log(n) with C=0.8....
a(n) = A209281(n) + 1. - Kevin Ryde, Jun 25 2022
EXAMPLE
S(1)={1,2} then M(1)=4 and S'(1)={4-1,4-2}={3,2}. So S(2)={1,2,3,2}. M(2)=5 so S(3)={1,2,3,2}{5-1,5-2,5-3,5-2} and sequence begins 1,2,3,2,4,3,2,3,...
PROG
(PARI) a(n) = n--; my(s=1, h); while((h = n>>s), n=bitxor(n, h); s<<=1); hammingweight(n) + 1; \\ Kevin Ryde, Jun 25 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Dec 10 2003
STATUS
approved