login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A068476
a(n) = Sum_{m=1..n} m*n^(m+(-1)^n).
1
0, 1, 20, 34, 5008, 3711, 1948356, 937924, 1205220416, 429794605, 1098765432100, 310989720966, 1390027428561168, 326011399456939, 2332600912091693348, 466937872906120456, 5016202619581534249216, 875711370981239308953
OFFSET
0,3
LINKS
FORMULA
If n >= 2, a(n) = n^(1+(-1)^n)*(n^n*(n^2-n-1)+1)/(n-1)^2. - Robert Israel, Nov 15 2017
EXAMPLE
a(2) = 2^(1+1)+2*2^(2+1) = 4+16 = 20.
MAPLE
b := n->sum(m*n^(m+(-1)^n), m=1..n);
# Alternative:
f:= n -> n^(1+(-1)^n)*(n^n*(n^2-n-1)+1)/(n-1)^2:
f(0):= 0: f(1):= 1:
map(f, [$0..40]);
MATHEMATICA
Table[Sum[m*n^(m+(-1)^n), {m, 1, n}], {n, 0, 30}] (* G. C. Greubel, Oct 13 2018 *)
PROG
(PARI) a(n) = sum(m=1, n, m*n^(m+(-1)^n)); \\ Michel Marcus, Nov 15 2017
(Magma) [0] cat [(&+[m*n^(m+(-1)^n): m in [1..n]]): n in [1..30]]; // G. C. Greubel, Oct 13 2018
CROSSREFS
Cf. A062806 (without the (-1)^n).
Sequence in context: A043946 A160937 A060124 * A003895 A157426 A325603
KEYWORD
nonn
AUTHOR
Francois Jooste (phukraut(AT)hotmail.com), Mar 10 2002
STATUS
approved