OFFSET
0,3
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..386
FORMULA
a(n) = 1 + (-1)^n * A001099(n).
MAPLE
a:= proc(n) option remember; `if`(n<0, 0, (-n)^n+a(n-1)) end:
seq(a(n), n=0..23); # Alois P. Heinz, Sep 12 2019
MATHEMATICA
RecurrenceTable[{a[0] == 1, a[n] == a[n-1] + (-n)^n}, a, {n, 0, 23}] (* Jean-François Alcover, Nov 27 2020 *)
PROG
(PARI) {a(n) = sum(k=0, n, (-k)^k)}
(Python)
from itertools import accumulate, count, islice
def A326501_gen(): # generator of terms
yield from accumulate((-k)**k for k in count(0))
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Seiichi Manyama, Sep 12 2019
STATUS
approved