logo

Primes That Leave a Remainder of 1 When Divided by 4 📂Number Theory

Primes That Leave a Remainder of 1 When Divided by 4

Theorem

Let p2p \ne 2 be a prime number.

For some a,bZa,b \in \mathbb{Z}, p1(mod4)p \equiv 1 \pmod{4}     \iff p=a2+b2p = a^2 + b^2

Explanation

While excluding p=2p=2, in fact, since it is 2=12+12 2= 1^2 + 1^2, it’s not a big deal to include it in the theorem.

For example, 131(mod4)13 \equiv 1 \pmod{4} is 13=4+9=22+32 13 = 4 + 9 = 2^2 + 3^2 371(mod4)37 \equiv 1 \pmod{4} is 37=1+36=12+62 37 = 1 + 36 = 1^2 + 6^2 611(mod4)61 \equiv 1 \pmod{4} is 61=25+36=52+62 61 = 25 + 36 = 5^2 + 6^2 These facts are interesting on their own but also have a deep connection with Gaussian primes, elevating number theory to a higher level.

Proof

(    )( \implies )

Part 1.

Since p1(mod4)p \equiv 1 \pmod{4}, for some kNk \in \mathbb{N}, it can be represented as p=4k+1p = 4k +1.

Euler’s Criterion: ap12(ap)(modp)\displaystyle a^{{p-1} \over {2}} \equiv \left( {a \over p} \right) \pmod{p}

By Euler’s criterion, (1p)(1)(4k+1)12(1)2k1(modp) \left( {{-1} \over {p}} \right) \equiv (-1)^{ {{ (4k + 1 ) - 1 } \over {2}} } \equiv (-1)^{2k} \equiv 1 \pmod{p} therefore, 1-1 is a quadratic residue in pp, and there exists cZc \in \mathbb{Z} satisfying c21(modp)c^{2} \equiv -1 \pmod{p}. Multiplying both sides by B2B^2 and rearranging gives (cB)2+B20(modp) (cB)^2 + B^2 \equiv 0 \pmod{ p } Letting A:=(cB)A := (cB), for some MZM \in \mathbb{Z} A2+B2=Mp A^2 + B^2 = Mp and M=A2+B2p(p1)2+12p=p2p2p<p M = {{ A^2 + B^2 } \over {p}} \le {{ (p-1)^2 + 1^2 } \over {p}} = p - {{ 2p - 2 } \over {p}} < p thus M<pM < p. Continuously reducing this MM to M=1M=1 means for some a,bZa,b \in \mathbb{Z}, p=a2+b2p = a^2 + b^2 can be said.


Part 2. 1r<M1 \le r < M

Consider u,vZu,v \in \mathbb{Z} satisfying uA(modM)vB(modM)M2u,vM2 u \equiv A \pmod{M} \\ v \equiv B \pmod{M} \\ - {{M} \over {2}} \le u,v \le {{M} \over {2}} (for example, if M=13M=13 and A10(mod13)A \equiv 10 \pmod{13}, then u3(mod13)u \equiv -3 \pmod{13}, so their existence is always assured). Then, since A2+B2=pMA^2 + B^2 = pM in Part 1, u2+v2A2+B20(modM) u^2 + v^2 \equiv A^2 + B^2 \equiv 0 \pmod{M} and for some rZr \in \mathbb{Z}, u2+v2=rMu^2 + v^2 = rM. Also, r=u2+v2M(M/2)2+(M/2)2M=M2<M r = {{ u^2 + v^2 } \over {M}} \le {{ (M/2)^2 + (M/2)^2 } \over { M }} = { { M } \over { 2 } } < M thus r<Mr < M.

Assuming r=0r = 0, since {0=uA(modM)0=vB(modM)\begin{cases} 0 = u \equiv A \pmod{M} \\ 0 = v \equiv B \pmod{M} \end{cases}, A,BA, B must be a multiple of MM, and A2+B2A^2 + B^2 must be a multiple of M2M^2. That is, MM must be a multiple of pp, but since M<pM < p is shown in Part 1, this is impossible, and rr must be at least greater than 00. Summarizing, 1r<M1 \le r < M.


Part 3.

According to the Cauchy-Schwarz inequality, (u2+v2)(A2+B2)=u2A2+v2A2+u2B2+v2B2=(u2A2+2uAvB+v2B2)+(v2A22uAvB+u2B2)=(uA+vB)2+(uAvB)2=(uAvB)BAAB(modM)0(modM) \begin{align*} & (u^2 + v^2) ( A^2 + B^2 ) \\ =& u^2 A^2 + v^2 A^2 + u^2 B^2 + v^2 B^2 \\ =& ( u^2 A^2 + 2uAvB + v^2 B^2 ) + ( v^2 A^2 - 2uAvB + u^2 B^2 ) \\ =& ( uA + vB )^2 + ( uA - vB )^2 \\ =& ( uA - vB ) \\ \equiv& BA - AB \pmod{M} \\ \equiv& 0 \pmod{M} \end{align*} thus (uAvB)( uA - vB ) is a multiple of MM. Also, since (uA+vB)AA+BB0(modM)( uA + vB ) \equiv AA + BB \equiv 0 \pmod{M} in the above Part 2, (uA+vB)( uA + vB ) is also a multiple of MM.


Part 4.

Since A2+B2=MpA^2 + B^2 = Mp and u2+v2=Mru^2 + v^2 = Mr, (u2+v2)(A2+B2)=M2rp (u^2 + v^2) ( A^2 + B^2 ) = M^2 r p and using the Cauchy-Schwarz inequality, (uA+vB)2+(uAvB)2=M2rp ( uA + vB )^2 + ( uA - vB )^2 = M^2 r p is obtained. Since (uA+vB)( uA + vB ) and (uAvB)( uA - vB ) are multiples of MM in the above Part 3, dividing both sides by M2M^2 gives (uA+vBM)2+(uAvBM)2=rp \left( {{ uA + vB } \over {M}} \right)^2 + \left( {{ uA - vB } \over {M}} \right)^2 = r p Defining a new A2:=(uA+vBM)B2:=(uAvBM)M2:=r A_{2} : = \left( {{ uA + vB } \over {M}} \right) \\ B_{2} := \left( {{ uA - vB } \over {M}} \right) \\ M_{2} := r for this gets us back to A22+B22=M2p A_{2}^{2} + B_{2}^{2} = M_{2} p Therefore, this Ak,Bk,MkA_{k}, B_{k}, M_{k} for kNk \in \mathbb{N} has the same properties defined in Parts 1~3.

Since r<Mr < M in the above Part 2, MkM_{k} decreases as kk increases, stopping exactly at M=1M=1.


(    )( \impliedby )

Since p=a2+b2p=a^2 + b^2 is odd, aa and bb cannot both be even or odd.

Let’s say for some n,mZn , m \in \mathbb{Z}, a:=2n+1a := 2n +1 , b=2mb = 2m. Then, p=a2+b2=4n2+4n+1+4m2=4(n2+n+m)+1 \begin{align*} p =& a^2 + b^2 \\ =& 4n^2 + 4n + 1 + 4m^2 \\ =& 4 ( n^2 + n + m ) +1 \end{align*} thus, p1(mod4)p \equiv 1 \pmod{4}.

By applying the Cauchy-Schwarz inequality and adding a few more conditions, a similar corollary can also be obtained for natural numbers.

Corollary

For odd mm, the remainder when dividing all prime factors by 44 is 11, or for even mm, if m2\displaystyle {{m} \over {2}} is odd and the remainder when dividing all prime factors of m2\displaystyle {{m} \over {2}} by 44 is 11     \iff gcd(a,b)=1\gcd ( a,b) =1 for some a,bZa,b \in \mathbb{Z}, then m=a2+b2m = a^2 + b^2

See Also