login
A221154
The generalized Fibonacci words q_n^[3].
4
1, 131, 1311, 1311313, 13113133133, 131131331331311313, 13113133133131131331331311311, 13113133133131131331331311311313313113113133131, 1311313313313113133133131131131331311311313313113113133133131131331331311311
OFFSET
0,2
LINKS
José L. Ramírez, Gustavo N. Rubiano, and Rodrigo de Castro, A Generalization of the Fibonacci Word Fractal and the Fibonacci Snowflake, arXiv preprint arXiv:1212.1368 [cs.DM], 2012.
MATHEMATICA
bar[a_List] := a /. {1 -> 3, 3 -> 1};
q[0, _] = {}; q[1, _] = {1}; q[2, i_] := If[EvenQ[i], Table[{1, 3}, {i/2}], Append[Table[{1, 3}, {(i-1)/2}], 1]] // Flatten;
q[n_, i_] := q[n, i] = If[EvenQ[i], If[Mod[n, 3] == 1, Join[q[n-1, i], q[n-2, i]], Join[q[n-1, i], q[n-2, i] // bar]], If[Mod[n, 3] == 0, Join[q[n-1, i], q[n-2, i]], Join[q[n-1, i], q[n-2, i] // bar]]];
a[n_] := q[n+1, 3] // FromDigits;
Table[a[n], {n, 0, 8}] (* Jean-François Alcover, Oct 02 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jan 04 2013
EXTENSIONS
a(6)-a(8) from Lars Blomberg, Sep 04 2017
STATUS
approved