Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #19 May 31 2024 14:37:49
%S 0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,1,0,1,
%T 0,2,0,1,0,1,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,2,0,1,0,2,
%U 0,1,0,1,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,1,0,1,0,2
%N Fixed point of the morphism 0 -> 01, 1 -> 02, 2 -> 01.
%C For related sequences, see notes in the Mathematica program.
%C The asymptotic density of the occurrences of k = 0, 1 and 2 is 1/2, 1/3 and 1/6, respectively. The asymptotic mean of this sequence is 2/3. - _Amiram Eldar_, May 31 2024
%H Antti Karttunen, <a href="/A191254/b191254.txt">Table of n, a(n) for n = 1..65537</a>
%F From _Jianing Song_, May 30 2024: (Start)
%F Recurrence: a(2n-1) = 0, a(2n) = 1, 2, 1 for a(n) = 0, 1, 2 respectively.
%F a(n) = 0 for odd n; a(n) = 1 for even n such that v2(n) is odd; a(n) = 2 for even n such that v2(n) is even, where v2(n) = A007814(n) is the 2-adic valuation of n. (End)
%t t = Nest[Flatten[# /. {0 -> {0, 1}, 1 -> {0, 2}, 2 -> {0, 1}}] &, {0}, 9] (* A191254 *)
%t Flatten[Position[t, 0]] (* A005408, the odds *)
%t a = Flatten[Position[t, 1]] (* A036554 *)
%t b = Flatten[Position[t, 2]] (* A108269 *)
%t a/2 (* A003159 *)
%t b/4 (* A003159 *)
%o (PARI) A191254(n) = if(n%2,0,if(valuation(n,2)%2,1,2)); \\ _Antti Karttunen_, Nov 06 2018
%Y Cf. A191250, A191255.
%Y Positions of 0 or 2: A003159; positions of 0: A005408; positions of 1: A036554; positions of 2: A108269.
%K nonn
%O 1,4
%A _Clark Kimberling_, May 28 2011