OFFSET
0,4
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(n) = (6*n^2+2*n-11+(2*n-5)*(-1)^n)/16+0^n.
a(n) = Sum_{i=1..n-1} (3*i+2)/4+(2-i)*(-1)^i/4.
From Robert Israel, May 19 2015: (Start)
G.f.: x^2*(x^3-x^2-2*x-1)/((x+1)^2*(x-1)^3).
E.g.f.: 1 + exp(x)*(6*x^2+8*x-11)/16 - exp(-x)*(2*x+5)/16.
a(n) = a(n-1)+2*a(n-2)-2*a(n-3)-a(n-4)+a(n-5) for n >= 6. (End)
From Bruno Berselli, May 20 2015: (Start)
a(n) = a(-n) for n odd, a(n) = a(-n)+n/2 otherwise.
a(n) = (floor(n/2)+1)*(floor(n/2)+2*floor((n-1)/2))/2 for n>0. Therefore, after 3, all terms of the sequence are composite. (End)
a(n) = Sum_{i=floor((n-1)/2)..n-1} i, for n>0. - Wesley Ivan Hurt, Apr 11 2016
EXAMPLE
n | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, ...
__________________________________________
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
+ 0, 0
+ 1, 1, 1
+ 2, 2, 2, 2
+ 3, 3, 3, 3, 3
+ 4, 4, 4, 4, 4, 4
+ 5, 5, 5, 5, 5, 5, 5
+ 6, 6, 6, 6, 6, 6, 6, 6
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
+ ...
__________________________________________
a(n)|0, 0, 1, 3, 6, 9,14,18,25,30,39, ...
MATHEMATICA
Join[{0}, Table[(6 n^2 + 2 n - 11 + (2 n - 5) (-1)^n)/16, {n, 100}]]
Table[Total@ Range[Floor[(n - 1)/2], n - 1], {n, 55}] (* Michael De Vlieger, Apr 11 2016 *)
PROG
(Magma) [(6*n^2+2*n-11+(2*n-5)*(-1)^n)/16+0^n: n in [0..60]]; // Vincenzo Librandi, May 20 2015
(Sage) [(6*n^2+2*n-11+(2*n-5)*(-1)^n)/16+0^n for n in (0..60)] # Bruno Berselli, May 20 2015
(Haskell)
a258087 n = a258087_list !! n
a258087_list = f 0 [0] $
map (\i -> take (i + 1) (repeat 0) ++ replicate (i + 2) i) [0..] where
f i ys@(y:_) (xs:xss) = (ys !! i) :
f (i + 1) (zipWith (+) (ys ++ repeat 0) xs) xss
-- Reinhard Zumkeller, May 21 2015
(PARI) a(n) = if (n==0, 0, sum(k = (n-1)\2, n-1, k)); \\ Michel Marcus, Apr 11 2016
(PARI) x='x+O('x^99); concat([0, 0], Vec(x^2*(x^3-x^2-2*x-1)/((x+1)^2*(x-1)^3))) \\ Altug Alkan, Apr 11 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, May 19 2015
STATUS
approved