login
a(n) = n^n - (n-1)^n + (n-2)^n - ... + (-1)^(k+n)*k^n + ... + (-1)^(2+n)*2^n + (-1)^(1+n)*1^n = Sum_{k=1..n} (-1)^(k+n)*k^n.
12

%I #24 Nov 02 2022 10:29:47

%S 1,1,3,20,190,2313,34461,607408,12360636,285188825,7356173275,

%T 209762134236,6552069616170,222481706868337,8159714626124985,

%U 321456928026650816,13538204870285608696,606979028986115413329

%N a(n) = n^n - (n-1)^n + (n-2)^n - ... + (-1)^(k+n)*k^n + ... + (-1)^(2+n)*2^n + (-1)^(1+n)*1^n = Sum_{k=1..n} (-1)^(k+n)*k^n.

%C p divides a(p-1) for prime p>2. p^k divides a(p^k-1) for all prime p and integer k>1. p^2 divides a(2p) and a(2p-1) for prime p>2. (p^k)^2 divides a(2p^k) for prime p>2 and integer k>0. (p^k)^2 divides a(2p^k-1) for all prime p and integer k>1.

%C It seems that a(n) ~ k*n^n with k = e/(e+1). - _Charles R Greathouse IV_, May 26 2015

%H Alois P. Heinz, <a href="/A120485/b120485.txt">Table of n, a(n) for n = 0..200</a>

%F a(n) = Sum_{k=1..n} (-1)^(k+n)*k^n.

%F a(n) = (-1)^n*((-1+2^(n+1))*Zeta[ -n] + (-2)^n*((Zeta[ -n,(n+1)/2] - Zeta[ -n,(n+2)/2]))).

%F a(n) = n! * [x^n] exp(x)*(exp(n*x) + 1)/(exp(x) + 1). - _Ilya Gutkovskiy_, Apr 07 2018

%F G.f.: Sum_{k>=0} (k * x)^k/(1 + k * x). - _Seiichi Manyama_, Dec 03 2021

%t Table[Sum[(-1)^(k+n)*k^n,{k,1,n}],{n,1,25}]

%o (PARI) a(n)=abs(sum(i=1,n,i^n*(-1)^i)) \\ _Charles R Greathouse IV_, May 26 2015

%o (PARI) my(N=20, x='x+O('x^N)); Vec(sum(k=0, N, (k*x)^k/(1+k*x))) \\ _Seiichi Manyama_, Dec 03 2021

%o (Magma) [(-1)^n*(&+[(-1)^k*k^n: k in [0..n]]): n in [0..40]]; // _G. C. Greubel_, Nov 01 2022

%o (SageMath) [(-1)^n*sum((-1)^k*k^n for k in range(n+1)) for n in range(41)] # _G. C. Greubel_, Nov 01 2022

%Y Cf. A031971, A089072.

%Y Main diagonal of A091884.

%K nonn

%O 0,3

%A _Alexander Adamchuk_, Jul 22 2006