# Distribution of prime numbers modulo $4$

Are primes equally likely to be equivalent to $$1$$ or $$3$$ modulo $$4,$$ or is there a skew in one direction?

That is my specific question, but I would be interested to know if there exists a trend more generally, say for modulo any even.

• I’d recommend you read JOURNAL ARTICLE Prime Number Races (though I found an error: 93 is not prime) Andrew Granville and Greg Martin The American Mathematical Monthly Vol. 113, No. 1 (Jan., 2006), pp. 1-33 Apr 22, 2019 at 13:58
• Do I understand correctly that your pool is from 3 up to some greater prime $p_k$ (that is to say, $k > 2$)? Then it depends on what $p_k$ is. Define a function $f(p) = -1$ if $p \equiv 3 \pmod 4$, otherwise $f(p) = 1$. Then I would hazard a guess that $$\sum_{i = 2}^k f(p)$$ changes sign infinitely often. Apr 22, 2019 at 16:25

In general, if $$\gcd(a,b) = 1$$, the number of primes which are of the form $$b$$ modulo $$a$$ is asymptotic to $$\dfrac{\pi(x)}{\varphi(a)}$$ where $$\pi(x)$$ is the number of primes $$\le x$$. As you see the asymptotic formula is independent of $$b$$ hence for a given modulo all residues occur equally in the long run.
• (for $b$ coprime to $a$, of course) Apr 22, 2019 at 12:56
Despite of Chebychev's bias (more primes with residue $$3$$ occur usually in practice), in the long run, the ratio is $$1:1$$.
• I would also note for future reference that the proof is given as an immediate consequence of Dirichlet’s Theorem and in general the primes are equidistributed modulo every $d$ with approximately $\frac{1}{\phi(d)}$ in each class. Apr 22, 2019 at 12:51
• I only know that Chebyshev noticed this phenomenon, no idea whether it has a mathematical reason. Also interesting : In the "race" between primes of the form $4k+1$ and $4k+3$ it is known that the lead switches infinite many often. Apr 22, 2019 at 13:00