login
A088016
To obtain a(n+1), add the square of the n-th partial sum to the n-th partial sum of the squares, then divide this result by a(n), for all n >= 0, with a(0)=1.
2
1, 1, 6, 17, 56, 179, 576, 1851, 5950, 19125, 61474, 197597, 635140, 2041543, 6562172, 21092919, 67799386, 217928905, 700493182, 2251609065, 7237391472, 23263290299, 74775653304, 240352858739, 772570939222, 2483290023101
OFFSET
0,3
FORMULA
a(n) = 3*a(n-1) + a(n-2) - a(n-3) for n>3.
G.f.: (1-2*x+2*x^2-x^3) / (1-3*x-x^2+x^3).
G.f.: A(x) = A030186(x) * (1-x+x^2), where A030186(x) = gf of A030186.
EXAMPLE
G.f.: A(x) = 1 + x + 6*x^2 + 17*x^3 + 56*x^4 + 179*x^5 + 576*x^6 + ...
where A(x) * (1 - 3*x - x^2 + x^3) = 1 - 2*x + 2*x^2 - x^3.
Illustration of the initial terms: set a(0) = a(1) = 1, then
a(2) = ((1+1)^2 + (1^2 + 1^2))/1 = 6;
a(3) = ((1+1+6)^2 + (1^2 + 1^2 + 6^2))/6 = 17;
a(4) = ((1+1+6+17)^2 + (1^2 + 1^2 + 6^2 + 17^2))/17 = 56;
a(5) = ((1+1+6+17+56)^2 + (1^2 + 1^2 + 6^2 + 17^2 + 56^2))/56 = 179; ...
MAPLE
seq(coeff(series((1-2*x+2*x^2-x^3)/(1-3*x-x^2+x^3), x, n+1), x, n), n = 0 .. 40); # G. C. Greubel, Oct 27 2019
MATHEMATICA
LinearRecurrence[{3, 1, -1}, {1, 1, 6, 17}, 40] (* Harvey P. Dale, Nov 06 2012 *)
PROG
(PARI) a(n)=(sum(k=0, n-1, a(k))^2+sum(k=0, n-1, a(k)^2))/a(n-1)
(PARI) my(x='x+O('x^40)); Vec((1-2*x+2*x^2-x^3)/(1-3*x-x^2+x^3)) \\ G. C. Greubel, Oct 27 2019
(Magma) I:=[1, 6, 17]; [1] cat [n le 3 select I[n] else 3*Self(n-1) +Self(n-2) -Self(n-3): n in [1..30]]; // G. C. Greubel, Oct 27 2019
(SageMath)
def A088016_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P((1-2*x+2*x^2-x^3)/(1-3*x-x^2+x^3)).list()
A088016_list(40) # G. C. Greubel, Oct 27 2019
(GAP) a:=[1, 6, 17];; for n in [4..40] do a[n]:=3*a[n-1]+a[n-2]-a[n-3]; od; Concatenation([1], a); # G. C. Greubel, Oct 27 2019
CROSSREFS
Sequence in context: A231223 A231437 A323358 * A010330 A109311 A391890
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Sep 18 2003
STATUS
approved