cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A264748 a(n) = Sum_{k = 1..n} (k^n - n^k).

Original entry on oeis.org

0, -1, -3, 14, 520, 11185, 239505, 5510652, 138456936, 3803230815, 113833152565, 3695302326650, 129479186068128, 4874312730972685, 196306448145080385, 8425000059348756472, 383956514250037779376, 18521535576956405481147, 942952190208348285876501
Offset: 1

Views

Author

Ilya Gutkovskiy, Nov 23 2015

Keywords

Examples

			a(1) = 1^1 - 1^1 = 0;
a(2) = 1^2 - 2^1 + 2^2 - 2^2 = -1;
a(3) = 1^3 - 3^1 + 2^3 - 3^2 + 3^3 - 3^3 = -3;
a(4) = 1^4 - 4^1 + 2^4 - 4^2 + 3^4 - 4^3 + 4^4 - 4^4 = 14;
a(5) = 1^5 - 5^1 + 2^5 - 5^2 + 3^5 - 5^3 + 4^5 - 5^4 + 5^5 - 5^5 = 520, etc.
		

Crossrefs

Programs

  • Mathematica
    Table[Sum[k^n - n^k, {k, 1, n}], {n, 1, 20}]
    Join[{0}, Table[HarmonicNumber[n, -n] - n (n^n - 1)/(n - 1), {n, 2, 20}]]
  • PARI
    a(n) = sum(k=1, n, k^n - n^k); \\ Altug Alkan, Nov 23 2015

Formula

a(n) = A031971(n) - A031972(n).
a(n) = ((1 - n)*zeta(-n, n + 1) - n*(n^n - 1) + (n - 1)*zeta(-n))/(n - 1) for n>1, where zeta(s) is the Riemann zeta function and zeta(s, a) is the Hurwitz zeta function.
a(n) ~ n^n / (exp(1) - 1). - Vaclav Kotesovec, Jul 16 2025