%I #26 Feb 16 2024 01:48:38
%S 1,1,-3,-26,161,2876,-27755,-740536,9722113,343603216,-5707904499,
%T -250756091552,5039646554593,264489160965056,-6237995487261915,
%U -380574552503498624,10303367499652761601,716309568462681538816,-21891769059478538933603
%N Real part of (1 + n*i)^n, where i=sqrt(-1).
%F a(n) = (1/2) * ( (i+n)^n + (i-n)^n ) * i^(n*(2*n+1)). - _Bruno Berselli_, Jan 28 2014
%F a(n) = Sum_{j=0..floor(n/2)} binomial(n,2j)*n^(2j)*(-1)^j. - _Chai Wah Wu_, Feb 15 2024
%e a(4) = 161 since (1 + 4i)^4 = (161 - 240i).
%t a[n_] := Re[(1 + n*I)^n]; Array[a, 18] (* _Robert G. Wilson v_, Aug 17 2006 *)
%o (PARI) a(n) = real((1 + n*I)^n); \\ _Michel Marcus_, Feb 14 2024
%o (Python)
%o from math import comb
%o def A121626(n): return sum(comb(n,j)*n**j*(-1 if j&2 else 1) for j in range(0,n+1,2)) # _Chai Wah Wu_, Feb 15 2024
%Y Cf. A115415.
%Y Cf. A370189 (imaginary part).
%K sign,easy
%O 0,3
%A _Gary W. Adamson_, Aug 12 2006
%E More terms from _Robert G. Wilson v_, Aug 17 2006