login
A125577
a(0) = 1; for n >= 1, a(n) = n^2 - a(n-1).
3
1, 0, 4, 5, 11, 14, 22, 27, 37, 44, 56, 65, 79, 90, 106, 119, 137, 152, 172, 189, 211, 230, 254, 275, 301, 324, 352, 377, 407, 434, 466, 495, 529, 560, 596, 629, 667, 702, 742, 779, 821, 860, 904, 945, 991, 1034, 1082, 1127, 1177, 1224, 1276, 1325, 1379, 1430
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
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
Cf. A000217.
Sequence in context: A084812 A050018 A347513 * A053307 A076065 A176115
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