I'm looking for a closed form for the following sum

$$\sum_{p\le n, p\text { prime}}\frac {(-n)^p} {p^n}$$


This sum is part of a EXP-calculation formula in a game I'm helping develope (I know, it sounds dumb to use such a complicated sum, but I'm not allowed to change it).

I mostly want a way to simplify calculations (for $n>10^{10}$), as the current method is just a very big, slow loop.

I know nothing of sums with primes, so any help would be greatly appreciated.

  • $\begingroup$ Call your sum $S_n$. Are you aware that $S_n$ is not monotone and not usually negative? e.g. $S_5=-5701/7776$ $\endgroup$ – parsiad Jan 6 '16 at 4:53
  • $\begingroup$ i.stack.imgur.com/371kF.jpg $\endgroup$ – parsiad Jan 6 '16 at 4:56
  • $\begingroup$ Really, why are you not allowed to change it? It seems like whoever imposed this sum didn't put a lot of thought into it. $\endgroup$ – Erick Wong Jan 9 '16 at 15:28
  • 1
    $\begingroup$ @ErickWong Agreed... I was explicitly told to "Not change any of the formulas, as they've been carefully designed by one of our engineers". I'm just going to tell them "Hey, your sum is just 0 or -1 depending on the n" and hope for a sensible response... $\endgroup$ – YoTengoUnLCD Jan 9 '16 at 17:49

We have the following approximation for large $n$

$$S_n \approx \left\{\matrix{-1 & n \text{ is prime}\\0 & \text{otherwise}}\right.$$

Your problem reduces to checking if $n$ is a prime, see Wikipedia. See the figure below for a plot of the error in this approximation as a function of $n$.

$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$Error as function of $n$

The reason for the approximation above is simple. In the sum

$$S_n = \frac{n^2}{2^n} - \frac{n^3}{3^n} - \frac{n^5}{5^n} - \ldots - \frac{n^{p_{\rm max}}}{p_{\rm max}^n}$$

most of the contribution when $n$ is large comes from the last term and the sum of all the previous terms is very small and can be ignored.

When $n$ is prime then $p_{\rm max} = n$ and the last term is $-1$. When $n$ is not a prime then $p_{\rm max} = n - \Delta$ for some integer $\Delta$. The last term is then

$$\frac{\left(1+\frac{\Delta}{p_{\rm max}}\right)^{p_{\rm max}}}{p_{\rm max}^{\Delta}} \approx \left(\frac{e}{p_{\rm max}}\right)^\Delta \ll 1$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.