login
A121626
Real part of (1 + n*i)^n, where i=sqrt(-1).
3
1, 1, -3, -26, 161, 2876, -27755, -740536, 9722113, 343603216, -5707904499, -250756091552, 5039646554593, 264489160965056, -6237995487261915, -380574552503498624, 10303367499652761601, 716309568462681538816, -21891769059478538933603
OFFSET
0,3
FORMULA
a(n) = (1/2) * ( (i+n)^n + (i-n)^n ) * i^(n*(2*n+1)). - Bruno Berselli, Jan 28 2014
a(n) = Sum_{j=0..floor(n/2)} binomial(n,2j)*n^(2j)*(-1)^j. - Chai Wah Wu, Feb 15 2024
EXAMPLE
a(4) = 161 since (1 + 4i)^4 = (161 - 240i).
MATHEMATICA
a[n_] := Re[(1 + n*I)^n]; Array[a, 18] (* Robert G. Wilson v, Aug 17 2006 *)
PROG
(PARI) a(n) = real((1 + n*I)^n); \\ Michel Marcus, Feb 14 2024
(Python)
from math import comb
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
CROSSREFS
Cf. A115415.
Cf. A370189 (imaginary part).
Sequence in context: A034493 A265467 A252872 * A038697 A226351 A091262
KEYWORD
sign,easy
AUTHOR
Gary W. Adamson, Aug 12 2006
EXTENSIONS
More terms from Robert G. Wilson v, Aug 17 2006
STATUS
approved