login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A079524
Expansion of (x + b*x^2 - b*x^3)/((1 - x^2)*(1 - x)^2) with b=2.
4
0, 1, 4, 6, 10, 13, 18, 22, 28, 33, 40, 46, 54, 61, 70, 78, 88, 97, 108, 118, 130, 141, 154, 166, 180, 193, 208, 222, 238, 253, 270, 286, 304, 321, 340, 358, 378, 397, 418, 438, 460, 481, 504, 526, 550, 573, 598, 622, 648, 673, 700, 726, 754, 781, 810, 838
OFFSET
0,3
FORMULA
G.f.: (x + 2*x^2 - 2*x^3) / ((1 - x)^2 * (1 - x^2)).
a(n) = a(n-2)+n (mod a(n-1)+n) with n>=2 and initial values (1, 1).
a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4), a(0)=0, a(1)=1, a(2)=4, a(3)=6. - Harvey P. Dale, Apr 20 2015
a(n) = (2*n*(n+6)-3*(1-(-1)^n))/8. - Luce ETIENNE, Jun 05 2015
EXAMPLE
G.f. = x + 4*x^2 + 6*x^3 + 10*x^4 + 13*x^5 + 18*x^6 + 22*x^7 + 28*x^8 + 33*x^9 + ...
Here b=2; a(0)=a(1)=1. a(2)= a(0)+2 (mod a(1)+2) = 3 (mod 3) =0 a(3)= a(1)+3 (mod a(2)+3) = 4 (mod 3) =1 a(4)= a(2)+4 (mod a(3)+4) = 4 (mod 5) =4 etc... we get 6, 13, 18, ...
MAPLE
a:= n-> (Matrix([[4, 1, 0, -2]]). Matrix(4, (i, j)-> if (i=j-1) then 1 elif j=1 then [2, 0, -2, 1][i] else 0 fi)^n)[1, 4]: seq(a(n), n=1..60); # Alois P. Heinz, Aug 06 2008
MATHEMATICA
b = 2; aa = {1, 1}; Do[AppendTo[aa, Mod[ aa[[ -2]] + n, aa[[ -1]] + n]], {n, b, 50}]; Drop[aa, 2]
CoefficientList[Series[(x+2*x^2-2*x^3)/((1-x)^2*(1-x^2)), {x, 0, 60}], x]
LinearRecurrence[{2, 0, -2, 1}, {0, 1, 4, 6}, 50] (* Harvey P. Dale, Apr 20 2015 *)
PROG
(PARI) my(x='x+O('x^50)); concat([0], Vec( (x+2*x^2-2*x^3)/((1-x)^2*(1- x^2)) )) \\ G. C. Greubel, Jan 15 2019
(Magma) m:=50; R<x>:=PowerSeriesRing(Integers(), m); [0] cat Coefficients(R!( (x+2*x^2-2*x^3)/((1-x)^2*(1- x^2)) )); // G. C. Greubel, Jan 15 2019
(Sage) ((x+2*x^2-2*x^3)/((1-x)^2*(1- x^2))).series(x, 50).coefficients(x, sparse=False) # G. C. Greubel, Jan 15 2019
(GAP) a:=[0, 1, 4, 6];; for n in [5..50] do a[n]:=2*a[n-1]-2*a[n-3]+a[n-4]; od; a; # G. C. Greubel, Jan 15 2019
CROSSREFS
Cf. A024206 and A078126.
Sequence in context: A186514 A184402 A350567 * A141740 A088135 A302660
KEYWORD
easy,nonn
AUTHOR
Carlos Alves, Jan 21 2003
STATUS
approved