login
Real part of (n + n*i)^n.
3

%I #30 Feb 16 2024 11:26:46

%S 1,1,0,-54,-1024,-12500,0,6588344,268435456,6198727824,0,

%T -9129973459552,-570630428688384,-19384006821904192,0,

%U 56050417968750000000,4722366482869645213696,211773507042902211629312,0,-1012950863698080557631477248,-107374182400000000000000000000

%N Real part of (n + n*i)^n.

%F a(n) = Re(n + n*i)^n.

%F From _Chai Wah Wu_, Feb 15 2024: (Start)

%F a(n) = n^n*Re((1+i)^n) = n^n*A146559(n) = n^n*Sum_{n=0..floor(n/2)} binomial(n,2j)*(-1)^j.

%F a(n) = 0 if and only if n==2 mod 4, as (1+i)^2=2i is purely imaginary, (1+i)^4=-4 is a nonzero real and (1+i) and (1+i)^3=-2+2i both have nonzero real parts.

%F (End)

%e a(7) = 6588344 since (7 + 7i)^7 = (6588344 - 6588344i).

%t a[n_] := Re[(n + n*I)^n]; Array[a, 19] (* _Robert G. Wilson v_, Aug 17 2006 *)

%o (PARI) a(n) = real((n + n*I)^n); \\ _Michel Marcus_, Dec 19 2020

%o (Python)

%o def A121625(n): return n**n*((1, 1, 0, -2)[n&3]<<((n>>1)&-2))*(-1 if n&4 else 1) # _Chai Wah Wu_, Feb 16 2024

%Y Cf. A115415, A121626, A146559.

%K sign

%O 0,4

%A _Gary W. Adamson_, Aug 12 2006

%E More terms from _Robert G. Wilson v_, Aug 17 2006

%E a(0)=1 prepended by _Alois P. Heinz_, Dec 19 2020