login
A173142
a(n) = n^n - (n-1)^(n-1) - (n-2)^(n-2) - ... - 1.
4
1, 3, 22, 224, 2837, 43243, 773474, 15903604, 369769661, 9594928683, 274906599294, 8620383706328, 293663289402069, 10799919901775579, 426469796631518922, 17997426089579351788, 808344199828497012733
OFFSET
1,2
LINKS
FORMULA
a(n) = 2*(n^n) - A001923(n), for n > 0. - Kritsada Moomuang, Feb 11 2019
EXAMPLE
1^1 - 0 = 1,
2^2 - 1 = 3,
3^3 - 2^2 - 1 = 22,
4^4 - 3^3 - 2^2 - 1 = 224, ...
MATHEMATICA
f[n_]:=n^n; lst={}; Do[a=f[n]; Do[a-=f[m], {m, n-1, 1, -1}]; AppendTo[lst, a], {n, 30}]; lst
Table[n^n -Sum[(n-k)^(n-k), {k, 1, n-1}], {n, 1, 20}] (* G. C. Greubel, Feb 11 2019 *)
PROG
(PARI) {a(n) = n^n - sum(k=1, n-1, (n-k)^(n-k))}; \\ G. C. Greubel, Feb 11 2019
(Magma) [n^n - (&+[(n-k)^(n-k): k in [1..n-1]]): n in [1..20]]; // G. C. Greubel, Feb 11 2019
(Sage) [n^n - sum((n-k)^(n-k) for k in (1..n-1)) for n in (1..20)] # G. C. Greubel, Feb 11 2019
CROSSREFS
Cf. A001923.
Sequence in context: A066573 A341476 A303190 * A073530 A120667 A196958
KEYWORD
nonn
AUTHOR
STATUS
approved