login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A008351 a(n) is the concatenation of a(n-1) and a(n-2) with a(1)=1, a(2)=2. 3

%I #45 Feb 19 2024 01:51:15

%S 1,2,21,212,21221,21221212,2122121221221,212212122122121221212,

%T 2122121221221212212122122121221221,

%U 2122121221221212212122122121221221212212122122121221212

%N a(n) is the concatenation of a(n-1) and a(n-2) with a(1)=1, a(2)=2.

%C A "non-commutative Fibonacci" sequence. Often written as: a, b, ba, bab, babba, babbabab, babbababbabba, babbababbabbababbabab, ...

%C Converges in the appropriate topology. - _Dylan Thurston_, Jan 28 2005

%C Do a web search on babbababbabbababbabab to get further links.

%C a(n) has Fibonacci(n) digits d_i where 1 <= i <= n and n > 2. If i is in A001950 then d_i = 1, otherwise it is 2 [Stolarsky]. - _David A. Corneth_, May 14 2017

%D D. E. Knuth, "The Art of Programming", Volume 1, "Fundamental Algorithms", third edition, problem 36 on page 86.

%H K. B. Stolarsky, <a href="http://dx.doi.org/10.4153/CMB-1976-071-6">Beatty sequences, continued fractions, and certain shift operators</a>, Canadian Math. Bull. 19 (1976) pp. 473-482.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Lindenmayer_system">Lindenmayer system</a>

%t a[1] = 1; a[2] = 2; a[n_] := 10^Floor[ Log[10, a[n - 2]] +1]*a[n - 1] + a[n - 2] (* _Robert G. Wilson v_, Jan 26 2006 *)

%o (PARI) a(n) = if (n<=2, n, eval(concat(Str(a(n-1)), Str(a(n-2))))); \\ _Michel Marcus_, May 14 2017

%o (PARI) a(n) = {if(n<=2, return(n));

%o my(v=vector(fibonacci(n),i,2), phi2 = (3+sqrt(5))/2, b = vector(fibonacci(n-2), i, (i*(sqrt(5)+3)/2))\1); for(i=1, fibonacci(n-2), v[(i*(3+sqrt(5))/2)\1] = 1); sum(i=1,#v,10^(#v-i) * v[i])}

%o a(n) = my(v=vector(n)); if(n <= 2, return(n)); v[1] = 1; v[2] = 2; for(i=3, n, v[i]=eval(concat(Str(v[i-1]), Str(v[i-2])))); v[#v] \\ _David A. Corneth_, May 14 2017

%Y See A008352 for another version.

%Y Cf. A014675: 1->2, 2->21.

%Y Cf. A001950.

%K nonn,base

%O 1,2

%A _N. J. A. Sloane_ and _J. H. Conway_

%E Title clarified by _Chai Wah Wu_, Mar 17 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 12:51 EDT 2024. Contains 371943 sequences. (Running on oeis4.)