Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found formula below$$p_n=6\left \lfloor \frac{p_n}{6}+\frac{1}{2} \right \rfloor+\left ( -1 \right )^\left \lfloor \frac{p_n}{3} \right \rfloor$$ for $n>2$, $p_n$ is prime number sequence.

Can anyone prove this formula?

share|cite|improve this question
This is just a question of noting that $p_n \equiv 1$ or $5$ (mod $6$). – Geoff Robinson Dec 30 '11 at 12:18
The correct answer to your question seems to be "yes". ;-) – Hans Lundmark Dec 30 '11 at 15:41
up vote 4 down vote accepted

For $n>2$ the prime $p_n$ is greater than $3$, so it must be of the form $6k+1$ or $6k+5$. If $p_n=6k+1$, then $$6\left\lfloor \frac{p_n}6+\frac12\right\rfloor= 6\left\lfloor k+\frac16+\frac12\right\rfloor=6k\;,$$ and $$\left\lfloor\frac{p_n}3\right\rfloor=\left\lfloor\frac{6k+1}3\right\rfloor=2k\;,$$ so $$6\left\lfloor\frac{p_n}6+\frac12\right\rfloor+(-1)^{\left\lfloor\frac{p_n}3\right\rfloor}=6k+(-1)^{2k}=6k+1=p_n\;.$$

If $p_n=6k+5$, then $$6\left\lfloor \frac{p_n}6+\frac12\right\rfloor= 6\left\lfloor k+\frac56+\frac12\right\rfloor=6(k+1)\;,$$ and $$\left\lfloor\frac{p_n}3\right\rfloor=\left\lfloor\frac{6k+5}3\right\rfloor=2k+1\;,$$ so $$6\left\lfloor\frac{p_n}6+\frac12\right\rfloor+(-1)^{\left\lfloor\frac{p_n}3\right\rfloor}=6(k+1)+(-1)^{2k+1}=6(k+1)-1=6k+5=p_n\;.$$

share|cite|improve this answer
OMG This is very fast.. I was struck dumb at this problem. Thank you – chimpanzee Dec 30 '11 at 12:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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