OFFSET
0,3
LINKS
Paul D. Hanna, Table of n, a(n) for n = 0..200
FORMULA
a(3^n) = 2*3^n - 1 for n>=0.
a(2*3^n) = 2*3^n for n>=0.
a(3^n-1) = 2 for n>=1.
a(3^n+1) = 3^n + 2 for n>=1.
a(n) == binomial(2*n,n)/(n+1) (mod 3); i.e., a(n) is congruent to Catalan number A000108(n) modulo 3.
EXAMPLE
G.f.: A(x) = 1 + x + 2*x^2 + 5*x^3 + 5*x^4 + 6*x^5 + 6*x^6 + 3*x^7 + 2*x^8 + 17*x^9 + 11*x^10 + 10*x^11 + 13*x^12 +...
The table of coefficients in A(x)^n reduced modulo 3 begins:
n=0: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...];
n=1: [1, 1, 2, 2, 2, 0, 0, 0, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, ...];
n=2: [1, 2, 2, 2, 0, 0, 0, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, ...];
n=3: [1, 0, 0, 1, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, ...];
n=4: [1, 1, 2, 0, 0, 2, 1, 1, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, ...];
n=5: [1, 2, 2, 0, 2, 2, 1, 0, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, ...];
n=6: [1, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...];
n=7: [1, 1, 2, 1, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, ...];
n=8: [1, 2, 2, 1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...];
n=9: [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, ...];
n=10:[1, 1, 2, 2, 2, 0, 0, 0, 2, 0, 0, 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 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0],...];
n=27:[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],...]; ...
where the antidiagonal sums form this sequence.
PROG
(PARI) {MOD(F, n)=local(V=Vec(F)); sum(k=0, #V-1, (V[k+1]%n)*x^k)+O(x^#V)}
{a(n)=local(A=1+x); for(i=1, n, A=1+sum(k=1, n, x^k*MOD((A+x*O(x^n))^k, 3))); polcoeff(A, n)}
for(n=0, 40, print1(a(n), ", "))
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Jan 23 2014
STATUS
approved