OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
a(n) = 2*a(n-1) - 2*a(n-3) + 1*a(n-4).
From Bruno Berselli, Jan 25 2011: (Start)
G.f.: x*(1 + 2*x + x^2 - x^3)/((1 + x)*(1 - x)^3).
a(n) = (6*n^2 + 8*n - (-1)^n - 7)/8. (End)
a(n) = round((6*n^2 + 8*n - 7)/8). - Bruno Berselli, Jan 25 2011
From Paul Curtz, Feb 09 2011: (Start)
a(n) - a(n-1) = A007494(n).
a(n) - a(n-2) = 3*n - 1 = A016789(n-1).
a(n) - a(n-4) = 6*n - 8 = A016957(n-2).
a(n) - a(n-8) = 12*n - 40 = A017617(n-4).
a(n) - a(n-16) = 24*n - 176 = 8*A016789(n-8).
a(n) - a(n-32) = 48*n - 736 = 16*A016789(n-16). (End)
a(n) = n^2 - floor((n-2)^2/4). - Bruno Berselli, Jan 17 2017
E.g.f.: (1/8)*(8 + (6*x^2 + 14*x -7)*exp(x) - exp(-x)). - G. C. Greubel, Jul 22 2017
MATHEMATICA
a=4/3; b=0;
Table[n+Floor[(a*n+b)^(1/2)], {n, 80}]
Table[n-1+Ceiling[(n*n-b)/a], {n, 60}]
Table[n - 1 + Ceiling[3 n^2/4], {n, 60}] (* or *) CoefficientList[ Series[x (1 + 2 x + x^2 - x^3)/((1 + x) (1 - x)^3), {x, 0, 60}], x] (* or *) Table[Round[(6 n^2 + 8 n - 7)/8], {n, 60}] (* Michael De Vlieger, Mar 23 2016 *)
LinearRecurrence[{2, 0, -2, 1}, {1, 4, 9, 15}, 60] (* Harvey P. Dale, Sep 16 2016 *)
PROG
(Magma) [(6*n^2 + 8*n - (-1)^n - 7)/8: n in [1..80]]; // Vincenzo Librandi, Feb 09 2011
(PARI) my(x='x+O('x^200)); Vec(x*(1+2*x+x^2-x^3)/((1+x)*(1-x)^3)) \\ Altug Alkan, Mar 23 2016
(Python)
def A184005(n): return n+((m:=3*n**2)>>2)-(not m&3) # Chai Wah Wu, Oct 01 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jan 08 2011
STATUS
approved