OFFSET
1,1
COMMENTS
When we prepend a '1' to the Catalan sequence modulo 3, the only nonzero digit strings are {1,1,1,2,2,2} and {2,2,2,1,1,1}; see A085297 for the occurrences of these digit strings.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
R. Stephan, Some divide-and-conquer sequences ...
R. Stephan, Table of generating functions
FORMULA
a(2*n-1) = 3, a(2*n) = 3*(a(n)+1), for n >= 1.
a(n) = (9 * 3^A007814(n) - 1) / 2 - 1. - Ralf Stephan, Oct 10 2003
From Johannes W. Meijer, Feb 11 2013: (Start)
a((2*n-1)*2^p) = (3^(p+2)-3)/2, p >= 0 and n >= 1. Observe that a(2^p) = A029858(p+2).
a(2^(p+3)*n + 2^(p+2) - 1) = a(2^(p+2)*n + 2^(p+1) - 1) for p >= 0 and n >= 1. (End)
MAPLE
nmax:=79: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := (3^(p+2)-3)/2 od: od: seq(a(n), n=1..nmax); # Johannes W. Meijer, Feb 11 2013
MATHEMATICA
Map[If[First@ # == 0, Length@ #, Nothing] &, SplitBy[Array[Mod[CatalanNumber@ #, 3] &, 10^4], # == 0 &]] (* Michael De Vlieger, Nov 02 2018 *)
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Jun 24 2003
STATUS
approved