# 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

## 2 Answers

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).

-

We use the follwing denotions

• $(i)_r$ - lower factorial,
• $S(n,k)$ - Stirling numbers of the second kind

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.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 14, "mathjax_display_tex": 2, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9234929084777832, "perplexity_flag": "middle"}