login
A122997
Pentanacci numbers for following initial values: a(0) = 1, a(1) = -1, a(2) = 1, a(3) = -1, a(4) = 1.
2
1, -1, 1, -1, 1, 1, 1, 3, 5, 11, 21, 41, 81, 159, 313, 615, 1209, 2377, 4673, 9187, 18061, 35507, 69805, 137233, 269793, 530399, 1042737, 2049967, 4030129, 7923025, 15576257, 30622115, 60201493, 118353019, 232675909, 457428793, 899281329, 1767940543, 3475679593, 6833006167, 13433336425
OFFSET
0,8
FORMULA
a(n) = a(n-1) + a(n-2) + a(n-3) + a(n-4) + a(n-5).
G.f.: (1 -2*x +x^2 -2*x^3 +x^4)/(1 -x -x^2 -x^3 -x^4 -x^5). - Maksym Voznyy (voznyy(AT)mail.ru), Aug 12 2009
MATHEMATICA
a[n_]:= a[n]= If[n<5, (-1)^n, Sum[a[n-j], {j, 5}]];
Table[a[n], {n, 0, 50}]
PROG
(Magma) [n le 5 select (-1)^(n-1) else Self(n-1) +Self(n-2) +Self(n-3) +Self(n-4) +Self(n-5): n in [1..51]]; // G. C. Greubel, Dec 23 2021
(Sage)
@CachedFunction
def A122997(n): return (-1)^n if (n<5) else sum( A122997(n-j) for j in (1..5) )
[A122997(n) for n in (0..50)] # G. C. Greubel, Dec 23 2021
CROSSREFS
Cf. A001591.
Sequence in context: A147243 A372451 A192664 * A146042 A291219 A284358
KEYWORD
sign
AUTHOR
Artur Jasinski, Oct 28 2006
STATUS
approved