|
|
A036585
|
|
Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.
|
|
9
|
|
|
3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 2, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
First differences of A001969. Observed by Franklin T. Adams-Watters, proved by Max Alekseyev, Aug 30 2006
|
|
REFERENCES
|
M. Lothaire, Combinatorics on Words. Addison-Wesley, Reading, MA, 1983, p. 26.
|
|
LINKS
|
|
|
FORMULA
|
|
|
PROG
|
(PARI) a(n)=if(n<1 || valuation(n, 2)%2, 2, 2-(-1)^subst(Pol(binary(n)), x, 1))
(Haskell)
a036585 n = a036585_list !! (n-1)
a036585_list = 3 : concat (map f a036585_list)
where f 1 = [1, 2, 3]; f 2 = [1, 3]; f 3 = [2]
def A036585(n): return 2+(n.bit_count()&1)-((n-1).bit_count()&1) # Chai Wah Wu, Mar 03 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|