%I #90 Mar 30 2023 05:12:04
%S 2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,2,1,
%T 2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,2,1,
%U 2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2
%N The infinite Fibonacci word (start with 1, apply 1->2, 2->21, take limit).
%C The limiting mean and variance of the first n terms are both equal to the golden ratio (A001622). - _Clark Kimberling_, Mar 12 2014
%C Let F = A000045 (Fibonacci numbers). For n >= 3, the first F(n)-2 terms of A014675 form a palindrome; see A001911. If k is not one of the numbers F(n)-2, then the first k terms of A014675 do not form a palindrome. - _Clark Kimberling_, Jul 14 2014
%C First differences of A000201. - _Tom Edgar_, Apr 23 2015 [Editor's note: except for the offset: as for A022342, below. - _M. F. Hasler_, Oct 13 2017]
%C Also first differences of A022342 (which starts at offset 1): a(n)=A022342(n+2)-A022342(n+1), n >= 0. Equal to A001468 without its first term: a(n) = A001468(n+1), n >= 0. - _M. F. Hasler_, Oct 13 2017
%C The word is a concatenation of three runs: 1, 2, and 22. The limiting proportions of these are respectively 1/2, 1 - phi/2, and (phi - 1)/2, where phi = golden ratio. The mean runlength is (phi + 1)/2. - _Clark Kimberling_, Dec 26 2010
%D D. Gault and M. Clint, "Curiouser and curiouser" said Alice. Further reflections on an interesting recursive function, Internat. J. Computer Math., 26 (1988), 35-43. See Table 2.
%D D. E. Knuth, The Art of Computer Programming, Vol. 4A, Section 7, p. 36.
%D G. Melançon, Factorizing infinite words using Maple, MapleTech journal, vol. 4, no. 1, 1997, pp. 34-42, esp. p. 36.
%H T. D. Noe, <a href="/A014675/b014675.txt">Table of n, a(n) for n = 0..10945</a> (20 iterations)
%H M. Bunder and K. Tognetti, <a href="http://dx.doi.org/10.1016/S0012-365X(01)00147-9">On the self matching properties of [j tau]</a>, Discrete Math., 241 (2001), 139-151.
%H D. Gault and M. Clint, <a href="/A005206/a005206.pdf">"Curiouser and curiouser said Alice. Further reflections on an interesting recursive function</a>, Intern. J. Computer. Math., 26 (1988), 35-43. (Annotated scanned copy)
%H J. Grytczuk, <a href="http://dx.doi.org/10.1016/0012-365X(95)00297-A">Infinite semi-similar words</a>, Discrete Math. 161 (1996), 133-141.
%H G. Melançon, <a href="http://dx.doi.org/10.1016/S0012-365X(99)00123-5">Lyndon factorization of sturmian words</a>, Discr. Math., 210 (2000), 137-149.
%H N. J. A. Sloane, <a href="/A115004/a115004.txt">Families of Essentially Identical Sequences</a>, Mar 24 2021 (Includes this sequence)
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F Define strings S(0)=1, S(1)=2, S(n)=S(n-1).S(n-2) for n>=2. Sequence is S(infinity).
%F a(n) = floor((n+2)*phi) - floor((n+1)*phi) = A000201(n+2) - A000201(n+1), phi = (1 + sqrt(5))/2.
%p Digits := 50: t := evalf( (1+sqrt(5))/2); A014675 := n->floor((n+2)*t)-floor((n+1)*t);
%t Nest[ Flatten[ # /. {1 -> 2, 2 -> {2, 1}}] &, {1}, 11] (* _Robert G. Wilson v_ *)
%t SubstitutionSystem[{1->{2},2->{2,1}},{1},{11}][[1]] (* _Harvey P. Dale_, Jan 01 2023 *)
%o (PARI) first(n)=my(v=[1],u); while(#v<n, u=List(); for(i=1,#v, listput(u,2); if(v[i]==2, listput(u,1))); v=Vec(u)); v[1..n] \\ _Charles R Greathouse IV_, Jun 21 2017
%o (PARI) apply( {A014675(n,r=quadgen(5)-1)=(n+2)\r-(n+1)\r}, [0..99]) \\ - _M. F. Hasler_, Apr 07 2021, improved on suggestion from _Kevin Ryde_, Apr 23 2021
%o (Python)
%o from math import isqrt
%o def A014675(n): return (n+2+isqrt(m:=5*(n+2)**2)>>1)-(n+1+isqrt(m-10*n-15)>>1) # _Chai Wah Wu_, Aug 10 2022
%Y This is the {2,1} version. The standard form is A003849 (alphabet {0,1}). See also A005614 (alphabet {1,0}), A003842 (alphabet {1,2} instead of {2,1}).
%Y Cf. A082389, A008351, A000045, A001622, A001911.
%Y Equals A001468 except for initial term.
%Y Differs from A025143 in many entries starting at entry 8.
%Y First differences of A000201 and of A022342.
%Y The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A000201 as the parent: A000201, A001030, A001468, A001950, A003622, A003842, A003849, A004641, A005614, A014675, A022342, A088462, A096270, A114986, A124841. - _N. J. A. Sloane_, Mar 11 2021
%K nonn,easy,nice
%O 0,1
%A _N. J. A. Sloane_
%E Corrected by _N. J. A. Sloane_, Nov 07 2001