|
|
A008351
|
|
a(n) is the concatenation of a(n-1) and a(n-2) with a(1)=1, a(2)=2.
|
|
3
|
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
A "non-commutative Fibonacci" sequence. Often written as: a, b, ba, bab, babba, babbabab, babbababbabba, babbababbabbababbabab, ...
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.
|
|
LINKS
|
|
|
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 *)
|
|
PROG
|
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|