login
A105202
Irregular triangle read by rows: row n gives the word f(f(f(...(1)))) [with n applications of f], where f is the morphism 1->{1,2,1}, 2->{2,3,2}, 3->{3,1,3}.
3
1, 1, 2, 1, 1, 2, 1, 2, 3, 2, 1, 2, 1, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 1, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 1, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 1, 3, 2, 3, 2, 3, 1, 3, 1, 2, 1, 3, 1, 3, 2, 3, 2, 3, 1, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3
OFFSET
0,3
COMMENTS
Row n contains 3^n symbols.
LINKS
F. M. Dekking, Recurrent sets, Advances in Mathematics, vol. 44, no. 1 (1982), 78-104; page 96, section 4.10.
FORMULA
Let r = A062153(1+(2*n)) [index of the row], let c = n - A003462(r) [index of the column], then a(n) = 1 + (a(A003462(r-1)+floor(c/3)) mod 3) if n ≡ 2 mod 3, otherwise a(n) = a(A003462(r-1)+floor(c/3)). - Antti Karttunen, Aug 12 2017
EXAMPLE
From Antti Karttunen, Aug 12 2017: (Start)
The rows 0 .. 3 of this irregular triangle:
1
1;2;1
1 2 1;2 3 2;1 2 1;
1 2 1 2 3 2 1 2 1;2 3 2 3 1 3 2 3 2;1 2 1 2 3 2 1 2 1
(End)
MATHEMATICA
f[n_] := Nest[ Flatten[ # /. {1 -> {1, 2, 1}, 2 -> {2, 3, 2}, 3 -> {3, 1, 3}}] &, {1}, n]; Flatten[ Table[ f[n], {n, 0, 4}]] (* Robert G. Wilson v, Apr 12 2005 *)
PROG
(Scheme, with memoization-macro definec)
(definec (A105202 n) (if (zero? n) 1 (let* ((r (A062153 (+ 1 (* 2 n)))) (c (- n (A003462 r))) (p (A105202 (+ (A003462 (- r 1)) (/ (- c (modulo c 3)) 3))))) (if (= 2 (modulo n 3)) (+ 1 (modulo p 3)) p))))
;; Antti Karttunen, Aug 12 2017
CROSSREFS
Each row is a prefix of A105203.
Sequence in context: A137900 A025837 A111317 * A240236 A356606 A099386
KEYWORD
nonn,tabf
AUTHOR
Roger L. Bagula, Apr 09 2005
EXTENSIONS
More terms from Robert G. Wilson v, Apr 12 2005
STATUS
approved