cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

1, 2, 21, 212, 21221, 21221212, 2122121221221, 212212122122121221212, 2122121221221212212122122121221221, 2122121221221212212122122121221221212212122122121221212
Offset: 1

Views

Author

Keywords

Comments

A "non-commutative Fibonacci" sequence. Often written as: a, b, ba, bab, babba, babbabab, babbababbabba, babbababbabbababbabab, ...
Converges in the appropriate topology. - Dylan Thurston, Jan 28 2005
Do a web search on babbababbabbababbabab to get further links.
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

References

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

Crossrefs

See A008352 for another version.
Cf. A014675: 1->2, 2->21.
Cf. A001950.

Programs

  • Mathematica
    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 *)
  • PARI
    a(n) = if (n<=2, n, eval(concat(Str(a(n-1)), Str(a(n-2))))); \\ Michel Marcus, May 14 2017
    
  • PARI
    a(n) = {if(n<=2, return(n));
    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])}
    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

Extensions

Title clarified by Chai Wah Wu, Mar 17 2021