6
$\begingroup$

Apologies in advance for the simplicity of the question, but I can't fathom how to write the following as a sum in Mathemaitca:

\begin{align} &\sum_{p}^{a}\sum_{n}^{b}\text{expression} \end{align}

where $p$ runs through the primes.

I would like to plot

\begin{align} &\sum_{p}^{a}\sum_{n}^{b}(1/n)p^{-ns} \end{align}

in $s$ for some $a,b$.

$\endgroup$
4
  • $\begingroup$ @Kuba thankyou very much - I think I haven't quite woken up yet! ;) $\endgroup$
    – martin
    Mar 2, 2015 at 11:10
  • $\begingroup$ @kuba - should I delete? $\endgroup$
    – martin
    Mar 2, 2015 at 11:11
  • $\begingroup$ I don't think so. Not bad question. I felt like it is a dupe but I've faile to find one. Let me post an answer. $\endgroup$
    – Kuba
    Mar 2, 2015 at 11:13
  • 1
    $\begingroup$ related: 52371 $\endgroup$
    – Kuba
    Mar 2, 2015 at 11:17

1 Answer 1

9
$\begingroup$

I think this is what you are after:

 mySum[s_, a_, b_]:= Sum[  1./n p^(-n s), 
                           {n, b},  
                           {p, Prime @ Range @ PrimePi @ a}]

Edit: skipper inner Sum, thanks to kguler's comment.

$\endgroup$
1
  • 3
    $\begingroup$ Simpler: Sum[1/n p^(-n s), {n, b}, {p, Prime@Range@PrimePi@a}] (+1) $\endgroup$
    – kglr
    Mar 2, 2015 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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