Prime Number Race
🔢 The Prime Number Race: 1 mod 4 vs. 3 mod 4
This exploration delves into a fascinating "race" between prime numbers, categorizing them based on their remainder when divided by 4. The two competing teams are primes that are 1 mod 4 (leave a remainder of 1) and primes that are 3 mod 4 (leave a remainder of 3).
🏁 The Rules of the Race
The race involves simply counting prime numbers as they appear in the number sequence, assigning them to one of two categories:
Team 1 mod 4: Primes
psuch thatp ≡ 1 (mod 4)Team 3 mod 4: Primes
psuch thatp ≡ 3 (mod 4)
The prime number 2 is disqualified as it is the only even prime and doesn't fit the mod 4 classification for odd numbers.
📜 Early Stages and Initial Observations
Let's track the first few primes:
3:
3 ≡ 3 (mod 4)(Team 3)5:
5 ≡ 1 (mod 4)(Team 1)7:
7 ≡ 3 (mod 4)(Team 3)11:
11 ≡ 3 (mod 4)(Team 3)13:
13 ≡ 1 (mod 4)(Team 1)17:
17 ≡ 1 (mod 4)(Team 1)19:
19 ≡ 3 (mod 4)(Team 3)23:
23 ≡ 3 (mod 4)(Team 3)29:
29 ≡ 1 (mod 4)(Team 1)31:
31 ≡ 3 (mod 4)(Team 3)37:
37 ≡ 1 (mod 4)(Team 1)
In the initial stages, Team 3 mod 4 consistently takes the lead, even if by a small margin. This initial observation suggests a bias towards primes that are 3 mod 4.
📈 Long-Term Race Behavior
The observed lead by Team 3 is not just an early-stage phenomenon:
Team 3 mod 4 maintains its lead for a surprisingly long time.
The first instance where Team 1 mod 4 takes the lead occurs at the prime 26,861. However, it's a brief lead, as the very next prime, 26,863, puts Team 3 back in front.
Team 1 mod 4 next takes the lead at 616,841, holding it for a bit longer before Team 3 regains dominance.
For 99% of the numbers observed, Team 3 mod 4 appears to be in the lead.
This led to a conjecture: As n tends to infinity, does the percentage of time Team 3 mod 4 is in the lead approach 100%?
🤔 Why the Bias?
Intuitively, one might expect primes to be unbiased in their distribution, especially after accounting for obvious factors like being odd. For instance, the last digits of primes (1, 3, 7, 9) tend to occur with roughly 25% frequency each in the long run, though some still show a gentle bias. The question then becomes: What gives 3 mod 4 primes this apparent advantage?
🧩 The Role of the Leibniz Formula for Pi/4
The explanation starts with a seemingly unrelated series, the Leibniz formula for π/4:
1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - 1/15 + ... = π/4
This series involves all odd numbers, not just primes, with alternating signs.
To formalize this, a function chi(n) is introduced:
chi(n) = +1ifn ≡ 1 (mod 4)chi(n) = -1ifn ≡ 3 (mod 4)chi(n) = 0ifnis even
The series can then be written as the sum of chi(n) / n.
This series converges to π/4, which is a constant number. The convergence means that the positive and negative terms must balance out over time.
🧙♂️ The "Number Theorist's Favorite Logarithm" Trick
A crucial "magical fact" in number theory allows for a transformation of such a series into a logarithmic form. This trick applies to series where:
Each natural number
nhas an associated term (e.g.,chi(n)/n).The product of terms for two numbers
aandbcorresponds to the term for their producta*b. For example,(chi(3)/3) * (chi(5)/5) = (-1/3) * (1/5) = -1/15, which ischi(15)/15.
When these conditions are met, one can "kick out" composite numbers and modify prime powers:
Primes: Keep their terms as is.
Prime Powers (
p^k): Keep their terms but reduce their contribution by . For example,1/9(which is3^2) would be reduced by1/2.Composite Numbers (with multiple prime factors, e.g., 15): Are kicked out entirely.
After applying this "logarithm trick," the modified series, which now primarily consists of primes and reduced prime powers, will equal the natural logarithm of the original series' sum. In our case, it would be ln(π/4).
This is a powerful concept because it transforms a series over all odd numbers into a series dominated by primes and prime powers, while still converging to a constant.
⚖️ Balancing the Positive and Negative Buckets
The fact that the transformed series converges to a constant (ln(π/4)) is key. It implies that the sum of the positive terms and the sum of the negative terms must balance each other out in the long run.
Let's look at the "buckets" of terms being added and subtracted in the transformed series:
Positive Bucket (Adding Terms) | Negative Bucket (Subtracting Terms) |
|---|---|
Reciprocals of primes | Reciprocals of primes |
Even powers of primes | Odd powers of primes |
The Critical Bias: Even Powers
A crucial observation is that all even powers of primes end up in the positive bucket.
If a prime
pis1 mod 4, thenp^2is1 mod 4, andchi(p^2) = +1.If a prime
pis3 mod 4, thenp^2is9 mod 4, which simplifies to1 mod 4. Sochi(p^2) = +1.
This means that terms like (1/2) * (1/p^2) are always positive, regardless of whether p was originally 1 mod 4 or 3 mod 4. This introduces a systematic bias towards the positive bucket.
For the overall series to converge to a constant (like ln(π/4)), the positive and negative contributions must cancel out. Since the positive bucket gets an "extra boost" from all even prime powers, the negative bucket needs more initial primes to compensate. This implies that there must be a bias for more primes that are 3 mod 4 to ensure the balance.
This provides an intuition, though not a formal proof, for why Team 3 mod 4 tends to be in the lead more often. The
3 mod 4primes are "working harder" to balance the series due to the positive contribution of all prime squares.
📊 The Truth About the Conjecture
The initial conjecture was that the proportion of numbers for which Team 3 is in the lead approaches 100%.
This conjecture is NOT true.
While Team 3 mod 4 is in the lead a vast majority of the time (e.g., 99.5% for the first billion numbers), this percentage does not tend to 100% as
napproaches infinity.The percentage wanders around. For example, it might be 99.5% for the first billion, but then 98% for the first quadrillion.
Team 1 mod 4 always gets a chance to be in the lead, no matter how far along the number line you go.
📏 A Different Metric: Weighted Sums
If the "rules of the race" are slightly modified by discounting each prime by its reciprocal (i.e., summing chi(p)/p for primes and weighted prime powers), then the situation changes for the long-term percentage:
Using this weighted metric, Team 3 mod 4 is in the lead approximately 99.59% of the time as you look at larger and larger numbers.
This is a "normal human" sense of "almost always," not the mathematical sense of approaching 100%.
Team 1 mod 4 will still be in the lead for about 0.5% of the time, even with this metric.
In conclusion, the "prime number race" reveals a subtle but persistent bias for primes of the form 3 mod 4, driven by the structure of analytic number theory series, specifically how prime powers contribute to the overall sum.

Ask anything
We've read this whole study set, so questions about it get the best answers.