# Prime Number Congruence Modulo 8 Proof

I want to rigorously prove that: $$p_n=2\Biggl(\Bigl\lfloor \frac{p_n+1}{8}\Bigr\rfloor+\Bigl\lfloor \frac{p_n+3}{8} \Bigr\rfloor+\Bigl\lfloor \frac{p_n+5}{8} \Bigr\rfloor+\Bigl\lfloor \frac{p_n+7}{8} \Bigr\rfloor\Biggr)-1+\delta(n,1) \quad\quad\quad\quad\quad\quad(0)$$

So far what has convinced me is the observations as follows:

$$\frac{p_n-5}{2}-2\Biggl(\Bigl\lfloor \frac{p_n-1}{8} \Bigr\rfloor+\Bigl\lfloor \frac{p_n-5}{8} \Bigr\rfloor\Biggr)+\frac{1}{2}\delta(n,1) \in {\{0,1}\}\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad(1)$$ $$\frac{p_n+1}{2}-2\Biggl(\Bigl\lfloor \frac{p_n+1}{8} \Bigr\rfloor+\Bigl\lfloor \frac{p_n+5}{8} \Bigr\rfloor\Biggr)-\frac{3}{2}\delta(n,1) \in {\{0,1}\}\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad(2)$$

$$\Bigl\lfloor \frac{n+1}{8} \Bigr\rfloor+\Bigl\lfloor \frac{n+3}{8} \Bigr\rfloor+\Bigl\lfloor \frac{n+5}{8} \Bigr\rfloor+\Bigl\lfloor \frac{n+7}{8} \Bigr\rfloor=\Bigl\lfloor \frac{n+1}{2} \Bigr\rfloor \,\,\forall n \in \mathbb N\quad\quad\quad\quad\quad\quad\quad\quad\quad\,\,\,\,(3)$$

$(3)$ explains why the RHS of $(0)$ must be odd, and $(0)$ being the sum of the expressions in lemmas $(1)$ & $(2)$ * show why the RHS of $(0)$ is equal to $p_n$, but this is as far as I can get without a text reference to something specifically relevant.

*I have manipulated these based on considerations of what a congruence relation implies, having the property of translation

• Your Equation (3) follows from Hermite's Identity (see the link in my answer). Aug 22, 2018 at 2:44
• You claims (1) and (2) also follow from Hermite's Identity (ignoring the case $n=1$ so $p_1=2$). Aug 22, 2018 at 2:50
• can you explain the notation: What is $p_n$ (is it the $n$-th prime?)? what is $\delta(n,1)$? Aug 22, 2018 at 6:14
• Sorry $$\delta \left( x,y \right) =\cases{1&x=y\cr 0&x\neq y\cr}$$ and yes as always $p_n$ is the $n^{th}$ prime number Aug 22, 2018 at 14:48

Here is an alternative way. It is well known that $$\lfloor nx\rfloor =\sum_{i=1}^n\,\left\lfloor x+\frac{i-1}{n}\right\rfloor\text{ for all }x\in\mathbb{R}\text{ and }n\in\mathbb{Z}_{>0}\,.$$ Take $n:=8$ and $x:=\dfrac{p}{8}$ if $p$ is an odd prime. Thus, we get $$p=\Biggl\lfloor 8\left(\frac{p}{8}\right)\Biggr \rfloor =\sum_{i=1}^8\,\left\lfloor\frac{p+i-1}{8}\right\rfloor=\sum_{i=1}^8\,\left\lfloor\frac{p+i}{8}\right\rfloor-1\,.$$ Now, since $p\equiv 1\pmod{2}$, we obtain $$\left\lfloor\frac{p+2i-1}{8}\right\rfloor=\left\lfloor\frac{p+2i}{8}\right\rfloor\text{ for }i=1,2,3,4\,.$$ This shows that $$p=2\,\sum_{i=1}^4\,\left\lfloor\frac{p+2i-1}{8}\right\rfloor-1\text{ for an odd prime }p\,.$$ You just have to check the case $p=2$ separately.