OFFSET
0,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (3,1,-1).
FORMULA
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
(Sage)
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
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Sep 18 2003
STATUS
approved