OFFSET
0,3
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..60
FORMULA
a(n) = 3^(n-1)*a(n-1) + a(n-2).
MAPLE
q:=3; seq(add((product((1-q^(2*(n-j-1-k)))/(1-q^(2*k+2)), k=0..j-1))* q^binomial(n-2*j, 2), j = 0..floor((n-1)/2)), n = 0..20); # G. C. Greubel, Dec 17 2019
MATHEMATICA
RecurrenceTable[{a[0]==0, a[1]==1, a[n]==a[n-1]*3^(n-1) + a[n-2]}, a, {n, 20}] (* Vincenzo Librandi, Nov 09 2012 *)
F[n_, q_]:= Sum[QBinomial[n-j-1, j, q^2]*q^Binomial[n-2*j, 2], {j, 0, Floor[(n-1)/2]}]; Table[F[n, 3], {n, 0, 20}] (* G. C. Greubel, Dec 17 2019 *)
PROG
(PARI) q=3; m=20; v=concat([0, 1], vector(m-2)); for(n=3, m, v[n]=q^(n-2)*v[n-1]+v[n-2]); v \\ G. C. Greubel, Dec 17 2019
(Magma) q:=3; I:=[0, 1]; [n le 2 select I[n] else q^(n-2)*Self(n-1) + Self(n-2): n in [1..20]]; // G. C. Greubel, Dec 17 2019
(Sage)
def F(n, q): return sum( q_binomial(n-j-1, j, q^2)*q^binomial(n-2*j, 2) for j in (0..floor((n-1)/2)))
[F(n, 3) for n in (0..20)] # G. C. Greubel, Dec 17 2019
(GAP) q:=3;; a:=[0, 1];; for n in [3..20] do a[n]:=q^(n-2)*a[n-1]+a[n-2]; od; a; # G. C. Greubel, Dec 17 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved