%I #59 Mar 28 2023 21:03:25
%S 1,2,1,1,1,2,1,1,2,1,1,1,2,1,2,1,1,1,2,1,1,2,1,1,1,1,2,1,1,1,2,1,1,2,
%T 1,1,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,2,1,1,1,2,1,1,2,1,1,1,1,2,1,1,1,2,
%U 1,1,2,1,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,2,1,1,1,2,1,1,2,1,1,1,1,2
%N "Look to the left" sequence starting with (1, 2): when the sequence has n terms, extend it by appending a(n) copies of a(1..n-1).
%C Stage 1: last term of 1,2 is 2 hence we add 2 copies of the block to the left of the last term (here 1) giving 1,2,1,1.
%C Stage 2: last term of 1,2,1,1 is 1 hence we add one copy of the block to the left of the last term (here 1,2,1) giving 1,2,1,1,1,2,1.
%C Stage 3: last term of 1,2,1,1,1,2,1 is 1 hence we add one copy of the block to the left of the last term (here 1,2,1,1,1,2) giving 1,2,1,1,1,2,1,1,2,1,1,1,2.
%C Iterate the process.
%H Iain Fox, <a href="/A293630/b293630.txt">Table of n, a(n) for n = 1..10369</a>
%H Benoit Cloitre, <a href="/A293630/a293630.png">Plot of Sum_{k=1..n} a(k)/n</a>
%F It seems that lim_{n->infinity} (a(1) + a(2) + ... + a(n))/n = 1.27526... (see link and A296564).
%F Because of the previous statement, it seems that the ratio of 2s to 1s in this sequence is 1:2.6329... (see A297927). - _Iain Fox_, Oct 15 2017
%t f[s_List] := Block[{a = Flatten[s][[-1]], b = Most@ s}, s = Join[s, Flatten@ Table[b, {a}]]]; Nest[f, {1, 2}, 6] (* _Robert G. Wilson v_, Dec 23 2017 *)
%o (PARI) v=[1,2];for(n=1,10,l=length(v);w=vector(l-1,i,v[i]);v=concat(v,if(v[l]-1,concat(w,w),w)));a(n)=v[n];
%Y "Look to the left" sequences: A322423 (seed 1,2,3), A322424 (seed 1,2,3,4), A322425 (seed 1,2,3,4,5).
%Y Cf. A291481, A296564, A297927, A322426.
%K nonn,nice
%O 1,2
%A _Benoit Cloitre_, Oct 14 2017
%E Self-contained name from _M. F. Hasler_, Dec 10 2018
|