The prime zeta function can be expressed inversely in terms of the Riemann zeta function:

$$P(s)=\sum_{k=1}^\infty\frac{\mu(k)}{k} \ln[\zeta(ks)]$$

The equation is defined here. The Mathworld page also defines other ways it can be expressed in terms of the Riemann Zeta function, but they are expressed where $\ln[\zeta(s)] = \mathrm{etc}$, not $P(s)=\mathrm{etc}$.

Can this be rewritten to not use the Möbius ($\mu$) Function and without prime summation ($\sum_{p}$)?

I am using this in a C++ program. I am using the Boost libraries, so I can use the zeta function (but Boost does not have the prime zeta function). It also does not have the Mobius function. This is why I cannot really use the Mobius function like in the equation above.

As well, to use prime summation (or similarly product of primes), I have to generate a large vector of primes (not optimal). This is why I cannot really use prime summation (or product of primes, I suppose).

  • $\begingroup$ Your question means nothing. By the way, do you know how to prove this formula ? $\endgroup$ – reuns Nov 4 '16 at 23:47
  • $\begingroup$ @user1952009 I am not out to prove it. I will update the question to provide a link to the Mathworld page where it is defined. $\endgroup$ – esote Nov 4 '16 at 23:48
  • $\begingroup$ You wouldn't have any hope to make it simpler, if you knew how to prove it $\endgroup$ – reuns Nov 4 '16 at 23:50
  • $\begingroup$ Which operations do you allow? $\endgroup$ – Charles Nov 4 '16 at 23:52
  • $\begingroup$ @user1952009 Thus why I ask it here, I have no idea how to redefine it without the Mobius function or prime summation, I was hoping someone here could be helpful. $\endgroup$ – esote Nov 4 '16 at 23:55

So your question seems to be: how can you program the prime zeta function in C++?

The easiest way would be to use an existing implementation in C++ or C. For example, I have one here PARI-extensions using the PARI library.

If you would prefer to write your own version using Boost, then you could re-implement my code (you'll probably want the primezeta_real function) using Boost instead of the PARI library. You would also need to write the Lambert W function, but that is not difficult and doesn't need to be done with high precision (it's used to determine how long you need to iterate a loop).

If you want to do a better job, you should read Cohen's High precision computation of Hardy-Littlewood constants which explains an efficient method. But the paper would be hard to follow for someone without a math background.

  • $\begingroup$ And $\sum_{k < x} \frac{\mu(k)}{k}\ln \zeta(sk)$ is a good approximation to $P(s)$, since $\ln \zeta(sk) = \mathcal{O}(2^{-k})$ (and in the code it seems it is computing $\mu(k)$ each $k$ separately, which is not a good idea) $\endgroup$ – reuns Nov 5 '16 at 0:36
  • $\begingroup$ Charles, thanks, your code is incredibly helpful. I am not sure if anyone else will be helpful, so I really appreciate it. I happen to have the Lambert W function programmed in C++ with arbitrary precision (it was really fun to code). With all my searching I can't believe I haven't heard of the PARI library! $\endgroup$ – esote Nov 5 '16 at 0:46
  • $\begingroup$ @Anonymous I'm glad it was useful! Yes, you should look into PARI/GP, it's very useful. In fairness, as user1952009 points out, my code is not terribly efficient -- with a sieve you could find the mu values faster. But if you're just using float or double precision it shouldn't be bad unless you're using arguments smaller than 1. $\endgroup$ – Charles Nov 5 '16 at 0:49

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.