So I want a function that is zero on the reals only on the prime integers and which doesn't depend on knowing the primes. I construct:

$$f(x) = e^{-x^2} - \sum\limits_{n=2}^\infty e^{-n^2} \frac{ \sin(\pi x)^2 }{ n^2\sin(\pi x/n)^2}$$

Which has zeros on the real line only on the positive and negative prime integers.

( $c_n(x)=\frac{\sin(\pi x)^2}{n^2\sin(\pi x/n)^2}$ has a well defined Taylor series and can be defined everywhere. It is $1$ when $x$ is a multiple of $n$ and 0 otherwise. The exponentials are just to make the whole thing converge.)

So my question is, is a function like this useful? As in, would it tell us anything about the primes?

Edit: if it is analytic, as well as zeros on the real axis it will have many complex zeros.

I also note that it is quite "easy" to convert this into a series of the form: $f(x)=\sum\limits_{k=0}^\infty a_{k} x^{k}$ where the coefficients $a_{2k} =\frac{(-1)^k}{k!} - \sum\limits_{n=2}^\infty c^{(2k)}_n(0)e^{-n^2}$. It begins $f(x)=0.981-0.97722x^2+...$ although you would need a lot of terms when $x$ is big!!! But we could say $f^{-1}(0)\subset$primes.

Edit 2: I think the function actually also has zeros at points very close to the primes and only the zeros where $f'(x)<0$ are primes. (Basically every second zero.) This works equally well replacing the exponentials with $1/x^2$.

  • $\begingroup$ Finding zeros of a function can be a non-trivial exercise. $\endgroup$ Apr 4, 2019 at 22:45
  • 1
    $\begingroup$ In other words it's not really a very useful function? $\endgroup$
    – zooby
    Apr 4, 2019 at 22:47
  • $\begingroup$ The Riemann Zeta function gas ties to the distribution of primes, but I don't know the relationship $\endgroup$ Apr 4, 2019 at 23:31
  • 1
    $\begingroup$ In other words, finding a function having its zeros be an interesting set is not necessarily a path to better understanding said set, as we don't have particularly strong tools to work with the set of zeros of an arbitrary function. That said, this by no means rules out something useful coming from a function like this, but the onus is really on you to find something interesting. :-) $\endgroup$ Apr 5, 2019 at 0:10

2 Answers 2


Yes: In case all zeroes have same order, in doubt consider f/f', one could derive a function with simple poles and residual 1 in primes; then a circular integral would deliver the number of enclosed primes. Concerning convergence rate, just an idea: May be there is a representation with elliptic functions, then fast Jacobi elliptic functions could serve.


I know that in computer science, a lot of cryptography algorithms rely on prime numbers because no one has ever found such an analytic function.

But yes, a function that has say, three or four zeros which happen to land on the prime might be useful to someone. I'll let others chime in on who might use it and why.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .