OFFSET
0,4
COMMENTS
It seems that this sequence can be calculated by constructing an insertion tree in which the insertion rules depend on the "age" of a term at a particular stage of the calculation. See the link for a discussion of this concept.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
P. de Castro et al., Counting binomial coefficients divisible by a prime power, Amer. Math. Monthly, 125 (2018), 531-540. See page 535.
John W. Layman, Ratio-Determined Insertion Sequences and the Tree of their Recurrence Types, June 2003 [Broken link]
John W. Layman, Ratio-Determined Insertion Sequences and the Tree of their Recurrence Types, June 2003 [local copy, corrected]
John W. Layman, Sequences Generated by Age-Determined Insertion Trees, Jan 2006
John W. Layman, Sequences Generated by Age-Determined Insertion Trees, Jan 2006 [Local copy]
FORMULA
G.f.: product((1+x^(3^j)+x^(2*(3^j))+x^(3*(3^j))+x^(4*(3^j))), j=0..infinity). - Emeric Deutsch, Apr 02 2006
For n>=1, a(3*n+2) = a(n); a(3*n+1) = a(n) + a(n-1); a(3*n) = a(n) + a(n-1). - Tom Edgar, Jun 21 2017
G.f. A(x) satisfies: A(x) = (1 + x + x^2 + x^3 + x^4) * A(x^3). - Ilya Gutkovskiy, Jul 09 2019
EXAMPLE
a(12) = 4 because 12=9+3=9+1+1+1=3+3+3+3=3+3+3+1+1+1.
MAPLE
g:= product((1+x^(3^j)+x^(2*(3^j))+x^(3*(3^j))+x^(4*(3^j))), j=0..10): gser:= series(g, x=0, 106): seq(coeff(gser, x, n), n=0..103); # Emeric Deutsch, Apr 02 2006
# second Maple program:
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<0, 0,
add(`if`(n-j*3^i<0, 0, b(n-j*3^i, i-1)), j=0..4)))
end:
a:= n-> b(n, ilog[3](n)):
seq(a(n), n=0..100); # Alois P. Heinz, Jun 21 2012
MATHEMATICA
b[n_, i_] := b[n, i] = If[n == 0, 1, If[i < 0, 0, Sum[If[n - j*3^i < 0, 0, b[n - j*3^i, i - 1]], {j, 0, 4}]]]; a[n_] := b[n, Floor[Log[3, n]]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Dec 22 2016, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
John W. Layman, Mar 27 2006
STATUS
approved