OFFSET
0,3
COMMENTS
A sequence given by a recurrence that is almost polynomial; it cannot be expressed as a polynomial, but is bounded by n^2.
If we let a(0) = 0, the triangular numbers result; a typo led to the new sequence.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
FORMULA
O.g.f.: (-1+2*x-4*x^2+x^3)/((-1+x)^3*(1+x)). a(n) = -n-1+(-1)^n+A000217(n+1). - R. J. Mathar, Dec 05 2007
a(n) = n*(n+1)/2 + (-1)^n = A000217(n) + (-1)^n. - Franklin T. Adams-Watters, Jul 13 2014
E.g.f.: exp(x)*(x+x^2/2) + exp(-x). - Franklin T. Adams-Watters, Jul 13 2014
EXAMPLE
a(0)=1, so a(1) = 1^2 - 1 = 0; a(2) = 2^2 - 0 = 4; a(3) = 9 - 4 = 5; etc.
MATHEMATICA
a[0] := 1 a[n_] := n^2 - a[n - 1]
CoefficientList[Series[(-1 + 2 x - 4 x^2 + x^3)/((-1 + x)^3 (1 + x)), {x, 0, 50}], x] (* Vincenzo Librandi, May 19 2014 *)
PROG
(Python)
a = 1
for n in range(1, 77):
print(a, end=', ')
a = n*n - a
(Magma) [1] cat [n le 1 select n-1 else n^2-Self(n-1): n in [1..50]]; // Vincenzo Librandi, May 19 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
John C. George (John.George(AT)ENMU.edu), Jan 03 2007
EXTENSIONS
Name corrected by Alex Ratushnyak, Aug 03 2012
STATUS
approved