login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A001099
a(n) = n^n - a(n-1), with a(1) = 1.
4
1, 3, 24, 232, 2893, 43763, 779780, 15997436, 371423053, 9628576947, 275683093664, 8640417354592, 294234689237661, 10817772136320355, 427076118244539020, 18019667955465012596, 809220593930871751581, 38537187481365665823843, 1939882468178947923300136
OFFSET
1,2
FORMULA
Absolute value of Sum_{k=1..n} k^k*(-1)^(k+1). a(n) = n^n - (n-1)^(n-1) + (n-2)^(n-2) - ... - (-1)^n*1^1. - Alexander Adamchuk, Jun 30 2006
MATHEMATICA
Abs[Table[Sum[k^k*(-1)^(k+1), {k, 1, n}], {n, 1, 30}]] (* Alexander Adamchuk, Jun 30 2006 *)
RecurrenceTable[{a[1]==1, a[n]==n^n-a[n-1]}, a, {n, 20}] (* Harvey P. Dale, Jan 21 2015 *)
PROG
(Python)
from itertools import accumulate, count, islice
def A001099_gen(): # generator of terms
yield from accumulate((k**k for k in count(1)), func=lambda x, y:y-x)
A001099_list = list(islice(A001099_gen(), 20)) # Chai Wah Wu, Jun 17 2022
CROSSREFS
Cf. A001923.
Sequence in context: A225107 A249926 A279651 * A277462 A371522 A230325
KEYWORD
nonn
AUTHOR
STATUS
approved