# Rational sum of the $p$-adic series

Koblitz states (as one of the excercises to chapter 2) that whenever we are given an integer $k > 0$ and prime $p$, the series $$f(p, k) = \sum_{n=0}^\infty n^kp^n$$ converges in $\mathbb Q_p$ and its limit is even rational (that is, in its $p$-adic expansion we can find a place from which the same finite sequence of digits repeats over and over). Can we find a explicit formula for $f(p, k)$ or maybe fix some $p_0$ and then efficiently compute the value of $f(p_0, k)$? Here are some initial terms:

$\begin{array}{c|ccccccc} p/k &1&2&3&4 & 5 & 6 & 7 & 8 & 9 & 10 \\\hline 2 &2& -6& 26& -150& 1082& -9366& 94586& -1091670&14174522& -204495126 \\ 3 &\frac{3}{4}&-\frac{3}{2}&\frac{33}{8}&-15&\frac{273}{4}&-\frac{1491}{4}&\frac{38001}{16}&-17295&\frac{566733}{4}&-\frac{2579313}{2} \\ 5 &\frac{5}{16}&-\frac{15}{32}&\frac{115}{128}&-\frac{285}{128}&\frac{3535}{512}&-\frac{26355}{1024}&?&-\frac{1139685}{2048}&?&? \\ 7 &\frac{7}{36}&-\frac{7}{27}&\frac{91}{216}&-\frac{70}{81}&\frac{2149}{972}&-\frac{3311}{486}&\frac{285929}{11664}&-\frac{220430}{2187}&?&? \end{array}$

$$\sum_{n=0}^\infty n^k x^n = \left(x \frac{d}{dx}\right)^k \frac{1}{1-x}.$$
• @Santiago Exactly. And the series converges for $|x|<1$, so in particular for $x=p$. Apr 18, 2016 at 20:22
To expand the hint given by Bruno Joyal I would like to point out that this is a special case of Hurwitz-Lerch zeta function. To evaluate it for any $k$ it's enough to transform a property of Euler polynomials proven by Frobenius (from OEIS) to get $$\sum_{n=0}^\infty n^k p^n = p \sum_{n=1}^k n!\left\{\begin{matrix} k \\ n \end{matrix}\right\} (p-1)^{-n-1}.$$