This is an idea that I had about 3 months ago. I tried some college professors, they didn't care. I tried to solve, but with no luck. I ask for help to find the closed form of the following product series. I know it would be safer only to put the product, but I just would like to see this solved, and if I put why I think this is important, the chance of someone helping would be higher.

My idea is:

If $\prod_{k=2}^{X-1}{\sin(\pi\frac{X}k)}≠0$, than the number $X$ is prime. Else, $X$ is a non-prime.


  • $\sin(\pi\frac{X}k)$ tests if a number k divides X. If the value returned is $0$, than k divides X. Because for a number to divide another, the result must be an integer, and $\sin(\pi\alpha)$ is equal to $0$ if and only if $\alpha$ is an integer. So, to test if a number, for example, k=3 divides 9, we could try that like $\sin(\pi\frac{9}3)=\sin(3\pi)=0$. Now let's try to see if 2 divides 11 this way: $\sin(\pi\frac{11}2)=\sin(5.5\pi)=-1≠0$
  • Using logic, we could extend this to the product above. We only need one sine being $0$ for the product to be $0$. That means that with only one divisor from range $2$ to $X-1$, the number X is a non-prime. And the only way for the product to be $0$ is if one or more of the sines is $0$: You can't multiply numbers $≠0$ and get $0$.

For example, 7 is prime if: $$\sin(\pi\frac{7}2)\times \sin(\pi\frac{7}3)\times \sin(\pi\frac{7}4)\times \sin(\pi\frac{7}5)\times \sin(\pi\frac{7}6)\ne 0$$ and that's the case.

I know I could test only until $\sqrt{7}$ rounded up, but if someone can get the closed form of the product, that wouldn't matter, and we wouldn't have to calculate the square root.

Thank you for reading this.

  • $\begingroup$ it will be very tough if not impossible , as there are no results for sin(a/b) as compared to those for sin(a+b) or even sin(a*b). Nice to see someone thinking new stuff $\endgroup$ – VigneshM Nov 9 '14 at 18:46
  • $\begingroup$ It's good that you're trying things out for yourself, but unfortunately this sort of primality test is ultimately useless. There's not going to be a closed form for this or any similar product. Take a look at this thread, this thread, or this thread for ideas similar to yours. Someone named "C.P. Willans" seems to be the originator of such methods. $\endgroup$ – curious Nov 9 '14 at 19:11

Assuming $X$ is an integer $\geq3$ your test is fine from a logical point of view. But it is completely useless if you want to find out whether $X:=63\,176\,591$ is prime. You would need millions of terms of the sine series in order to compute a single factor of your product, say $\sin\bigl(\pi{X\over 31}\bigr)$. But even if you computed all these factors to $10^6$ places, in a numerically unlucky situation you would not be able to decide definitively that the product is $\ne0$.

  • $\begingroup$ Yes, this product series is useless unless someone could find its closed form. There are closed forms really close to this, like $\prod_{k=1}^{n-1}\sin\frac{k \pi}{n} = \frac{n}{2^{n-1}}$. But it seems this one is impossible, like the others have said. $\endgroup$ – Paulo Felipe Nov 10 '14 at 0:03

This test is useless because this product tends to zero for big numbers. Even the result for 1273 (prime) is $0$ for the computer, because it gets too small. The sine values varies between 0 and 1, so the product gets smaller and smaller... I even did an approximation for that product (possibly wrong), which gave me a complex answer but also returned $0$ for big numbers.

I'm trying to think now of a function that returns $f(integer)=0$, but gives $|f(non-integer)|\ge1$

Since I already wasted some time trying to do this approximation I'll share it. But again, I don't know if this is correct:


$P(X)=(2i)^{2-x}\prod_{k=2}^{X-1}{(e^{i\pi X/k}-e^{-i\pi X/k})}$

$P(X)=(2i)^{2-x}\prod_{k=2}^{X-1}{e^{i\pi X/k}}\times\prod_{k=2}^{X-1}{(1-e^{-2i\pi X/k})}$

$$P(X)=(2i)^{2-x}\prod_{k=2}^{X-1}{e^{i\pi X/k}}\times(-1)^{X-2}\times\prod_{k=2}^{X-1}{(e^{-2i\pi X/k}-1)}$$

$\prod_{k=2}^{X-1}{e^{i\pi X/k}}=exp(\sum_{2}^{X-1}{\frac{i\pi X}{k}})=exp(i\pi X\times\sum_{2}^{X-1}{\frac{1}{k}})$

$\prod_{k=2}^{X-1}{e^{i\pi X/k}}\approx exp[i\pi X(lnX+0.57722+\frac{1}{2X}-1)]$

$$\prod_{k=2}^{X-1}{e^{i\pi X/k}}\approx exp[i\pi X(lnX-0.4228+\frac{1}{2X})]$$

Now using this: Evaluating the infinite product $\prod\limits_{k=2}^\infty \left ( 1-\frac1{k^2}\right)$

$\prod_{k=2}^{X-1}{(e^{-2i\pi X/k}-1)}=(-1)^{X-2}\times\prod_{k=2}^{X-1}{(1-e^{-2i\pi X/k})}$

$=(-1)^{X-2}\times\prod_{k=2}^{X-1}{(1-\frac{1}{exp(2i\pi X/k)}})=$

$=(-1)^{X-2}\times\prod_{k=2}^{X-1}{(1-\frac{1}{exp(i\pi X/k)})(1+\frac{1}{exp(i\pi X/k)}})=$

$=(-1)^{X-2}\times\prod_{k=2}^{X-1}{(\frac{exp(i\pi X/k)-1}{exp(i\pi X/k)}\times\frac{exp(i\pi X/k)+1}{exp(i\pi X/k)})}$

Where $\frac{exp(i\pi X/k)+1}{exp(i\pi X/k)}=a_k$ and $\frac{exp(i\pi X/k)-1}{exp(i\pi X/k)}=\frac{1}{a_{k-1}}$

$$\prod_{k=2}^{X-1}{(e^{-2i\pi X/k}-1)}=(-1)^{X-2}\times(\frac{1+exp(\frac{i\pi X}{X-1})}{exp(\frac{i\pi X}{X-1})})\times(\frac{exp(i\pi X)}{1+exp(i\pi X)})$$

So, the answer would be:

$$P(X)\approx(2i)^{2-X}\times exp[i\pi X(lnX-0.4228+\frac{1}{2X})] \times (\frac{1+exp(\frac{i\pi X}{X-1})}{exp(\frac{i\pi X}{X-1})})\times(\frac{exp(i\pi X)}{1+exp(i\pi X)})$$


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.