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
KEYWORD
sign,easy
AUTHOR
Gary W. Adamson, Aug 12 2006
EXTENSIONS
More terms from Robert G. Wilson v, Aug 17 2006
STATUS
approved