%I M0100 #49 Aug 26 2018 04:45:57
%S 2,1,2,1,2,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,
%T 2,1,2,1,2,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,
%U 2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,1
%N An "eta-sequence": [ (n+1)*tau + 1/2 ] - [ n*tau + 1/2 ], tau = (1 + sqrt(5))/2.
%C Equals its own "derivative", which is formed by counting the strings of 1's that lie between 2's.
%C Conjecture: A006340 = continued fraction expansion of (2.729967741... = sup{f(n,1)}), where f(1,x) = x + 1 and thereafter f(n,x) = x + 1 if n is in the lower Wythoff sequence (A000201), else f(n,x) = 1/x. The first 12 values of f(n,1) are given in Example at A245216. - _Clark Kimberling_, Jul 14 2014
%C From _Michel Dekking_, Mar 05 2018: (Start)
%C The description of this sequence is not correct, since the derivative of a equals
%C a' = 1,2,2,1,2,2,1,2,1,2,2,1,2,1,2,2,...
%C The claim by Hofstadter in formula (4) in the 1977 letter to Sloane is also not correct, since the second derivative of a is equal to
%C a'' = 2,2,1,2,1,2,2,1,2,1,2,2,1,...
%C so a is not equal to its own second derivative.
%C Nevertheless, this sequence has a self-similarity property: if one replaces every chunk 212 with 1 and every chunk 21212 with 2, then one obtains back the original sequence. In other words, (a(n)) is the unique fixed point of the morphism sigma given by sigma: 1->212, 2->21212.
%C This can be proved following the ideas of Chapter 2 in Lothaire's book and Section 4 of my paper "Substitution invariant Sturmian words and binary trees".
%C To comply with these references change the alphabet to {0,1}. This changes sigma into the morphism 0->101, 1->10101.
%C The fractional part {tau} of tau is larger than 1/2; as it is convenient to have it smaller than 1/2 we change to beta = 1-tau = (3-sqrt(5))/2.
%C This changes the morphism 0->101, 1->10101 to its mirror image psi given by 0->01010, 1->010.
%C Let psi_1 and psi_2 be the elementary Sturmian morphisms given by
%C psi_1(0)=01 , psi_1(1)=1, psi_2(0)=10, psi_2(1)=0.
%C Then psi = psi_2^2 psi_1.
%C This already shows that psi generates a Sturmian sequence with certain parameters alpha and rho: s(alpha,rho) = ([(n+1)*alpha+rho]-[n*alpha+rho]).
%C Since psi is the composition psi_2^2psi_1, the parameters of s(alpha,rho) are given by the composition T:=T_2^2T_1 of the fractional linear maps
%C T_1(x,y) = ((1-x)/(2-x),(1-y)/(2-x)),
%C T_2(x,y) = ((1-x)/(2-x), (2-x-y)/(2-x)).
%C Since one can verify that T(beta,1/2)=(beta,1/2), it follows that
%C alpha = beta, and rho = 1/2.
%C (End)
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H T. D. Noe, <a href="/A006340/b006340.txt">Table of n, a(n) for n = 0..1000</a>
%H Michel Dekking, <a href="http://arxiv.org/abs/1705.08607">Substitution invariant Sturmian words and binary trees</a>, arXiv:1705.08607 [math.CO], (2017).
%H Michel Dekking, <a href="http://math.colgate.edu/~integers/sjs7/sjs7.Abstract.html">Substitution invariant Sturmian words and binary trees</a>, Integers, Electronic Journal of Combinatorial Number Theory 18A (2018), #A17.
%H D. R. Hofstadter, <a href="/A006336/a006336_1.pdf">Eta-Lore</a> [Cached copy, with permission]
%H D. R. Hofstadter, <a href="/A006336/a006336_2.pdf">Pi-Mu Sequences</a> [Cached copy, with permission]
%H D. R. Hofstadter and N. J. A. Sloane, <a href="/A006336/a006336.pdf">Correspondence, 1977 and 1991</a>
%H M. Lothaire, <a href="http://tomlr.free.fr/Math%E9matiques/Fichiers%20Claude/Auteurs/aaaDivers/Lothaire%20-%20Algebraic%20Combinatorics%20On%20Words.pdf">Algebraic combinatorics on words</a>, Cambridge University Press. Online publication date: April 2013; Print publication year: 2002.
%t Differences[ Table[ Round[ GoldenRatio*n], {n, 0, 93}]] (* _Jean-François Alcover_, Aug 13 2012 *)
%o (PARI) rt(n) = my(tau=(1 + sqrt(5))/2); round(tau*n)
%o a(n) = rt(n+1)-rt(n) \\ _Felix Fröhlich_, Aug 26 2018
%Y Differs from A014675 in many places. Cf. A245216.
%K nonn,easy,nice
%O 0,1
%A D. R. Hofstadter, Jul 15 1977
%E Extended by _N. J. A. Sloane_, Nov 07 2001