# What is the sum of $\sum\limits_{i=1}^{n}i^k p^i$?

(I've asked similar question, but this is much more complicated, I think)

What is the sum of $\sum\limits_{i=1}^{n}i^k p^i$?

Interpretation (why is it important ) :
$f(k,n,p)=\sum\limits_{i=1}^{n}i^k p^i$
if n goes to plus infinity, then $f(1,n,1/2)$ is average length or series of heads while tipping symmetric coin, and $f(2,n,1/2)-f(1,n,1/2)^2$ is the variance of that length, so for another k we get k-th moment

-
These quantities are well-studied when $p = 1,$ and there are inductive formulae for them. –  Geoff Robinson Aug 8 '12 at 10:36

Well, starting again with $f(p)=\sum_{i=1}^n p^i=\frac {p(p^n-1)}{p-1}$
Consider the theta operator $\Theta=p\frac d{dp}$ then your answer is $\Theta^k(f(p))$
(compute the derivative, multiply by $p$, repeat $k$ times).
Recall that each power of a number can be expressed in terms of its lower factorials $$i^k=\sum\limits_{r=0}^k S(k, r)(i)_r$$ So we can write \begin{align} f(k,n,p)=\sum\limits_{i=1}^n i^k p^i&= \sum\limits_{i=1}^n \left(\sum\limits_{r=0}^k S(k, r)(i)_r\right) p^i\\ &=\sum\limits_{i=1}^n \sum\limits_{r=0}^k S(k, r)(i)_r p^i \\ &=\sum\limits_{i=1}^n \sum\limits_{r=0}^k S(k, r) p^r \frac{d^r}{dp^r}(p^i)\\ &=\sum\limits_{r=0}^k \sum\limits_{i=1}^n S(k, r) p^r \frac{d^r}{dp^r}(p^i)\\ &=\sum\limits_{r=0}^k S(k, r) p^r\frac{d^r}{dp^r}\left(\sum\limits_{i=1}^n p^i\right)\\ &=\sum\limits_{r=0}^k S(k, r) p^r\frac{d^r}{dp^r}\left(\frac{p^{n+1}-p}{p-1}\right) \end{align} For each fixed $k$ one may compute this sum.