Balanced Prime Calculator
Number Theory
- The prime below 53 is 47 and the prime above is 59.
- Their mean is (47 + 59) / 2 = 53.
- A prime is balanced when that mean equals the prime itself: 53 = 53.
- Verdict: 53 is a balanced prime.
Some primes sit in unusually even company. A balanced prime is one that is exactly the average of the prime immediately before it and the prime immediately after it - the three primes form a tiny arithmetic progression, with the balanced prime at its centre. The first example is 5, the mean of 3 and 7; the next is 53, the mean of 47 and 59.
Use test mode to check a single prime: enter it above and the calculator finds its two neighbouring primes, averages them and compares. Use list mode to generate every balanced prime up to your bound. The list grows slowly - up to 1,000 there are just 15 of them: 5, 53, 157, 173, 211, 257, 263, 373, 563, 593, 607, 653, 733, 947 and 977.
Balanced primes are the middle case of a natural three-way classification. A prime greater than the mean of its neighbours is called a strong prime; one below the mean is a weak prime. The names come from cryptography, where the distinction once mattered for choosing RSA primes - though modern practice has largely moved on, the classification remains a neat way to see the local texture of the primes.
One way to feel the definition is to look at the primes around 100: 97, 101, 103, 107, 109, 113. Is 103 balanced? Its neighbours are 101 and 107, whose mean is 104 - close, but not 103, so no. Is 107 balanced? Neighbours 103 and 109 average 106 - no again. Near misses like these are the norm; exact balance is the exception that this page exists to catch.
Worked examples
Is 53 a balanced prime?
(Test a value · 53)
| Balanced prime result | Yes - balanced prime |
| Previous prime | 47 |
| Next prime | 59 |
| Neighbour mean | 53 |
Is 51 a balanced prime?
(Test a value · 51)
| Balanced prime result | Not a balanced prime |
| Reason | Not prime |
Balanced primes up to 1,000
(List values · 1000)
| Balanced prime result | 15 balanced primes |
| First five | 5, 53, 157, 173, 211 |
| Largest in range | 977 |
What 'balanced' means, precisely
For a prime p with previous prime p- and next prime p+, p is balanced when p = (p- + p+) / 2 - equivalently, when the gap below equals the gap above. For 53 the gaps are 53 - 47 = 6 and 59 - 53 = 6. Equal gaps are the whole content of the definition; nothing else about the number matters.
Because prime gaps beyond the start are even, the two gaps being equal is not exotic - but the run of primes has to cooperate twice in a row, which is why balanced primes thin out quickly. The calculator's neighbour search makes the test exact: there is no approximation anywhere in it.
Worked checks
53 passes: neighbours 47 and 59, mean 53. 157 passes with neighbours 151 and 163, gaps of 6 and 6. 211 passes with 199 and 223 - gaps of 12 and 12, showing that balanced primes can sit in wide, symmetric gaps as well as tight ones. 5 is the smallest, centred between 3 and 7.
51 fails before the test even begins - it is 3 x 17, not prime at all, and only primes can be balanced. That two-stage structure (primality first, balance second) is why the calculator reports 'not prime' as a separate verdict from 'prime but not balanced'.
Strong, weak and balanced primes
A strong prime exceeds the mean of its neighbours; a weak prime falls short of it. Early RSA guidance preferred strong primes for the modulus factors, fearing Pollard's p-1 factoring method; later analysis showed the protection was mostly illusory at realistic key sizes, and modern key generation simply uses random large primes.
The classification survives as descriptive language for prime patterns - and because the three classes together partition the primes (from 5 onwards) into an appealing census. Heuristics suggest the three classes occur with comparable frequency, with balanced the rarest of the three at large sizes.
How the list is built
List mode sieves the primes up to your bound (plus a margin to find the next prime past the last candidate), then tests each prime against its sieve neighbours. Up to 1,000 the answer is the 15 values quoted above; the largest is 977, centred on 971 and 983.
The count grows irregularly - long dry spells, then clusters like 257 and 263 close together. That lumpiness is typical of prime-pattern sequences and is one reason conjectures in this area are stated as asymptotic densities rather than exact counts.
Balanced primes and arithmetic progressions
A balanced prime is the middle term of a three-term arithmetic progression of primes. Longer prime arithmetic progressions - the subject of the Green-Tao theorem - are far rarer and deeper, but the three-term case is elementary: it is exactly the statement that two consecutive prime gaps are equal.
Equal consecutive gaps also produce the patterns catalogued as prime constellations in some references. If you enjoy this page, the neighbouring-prime machinery is shared with the interprime calculator on this site, which looks at the same gaps from the composite side.
Where balanced primes are catalogued
The sequence of balanced primes is OEIS A006562, which lists values and counts far beyond this page's range, together with references to the literature on prime gaps. The counts of balanced primes below powers of 10 are themselves a small sequence used to test density heuristics.
Nothing about balanced primes is conjectural at the sizes this calculator handles - every verdict is a finite check - but their long-run density is a heuristic matter, like most fine structure in the primes.
Density and expectations
How many balanced primes should there be below x? A standard heuristic treats the gaps around a prime as roughly independent draws, and the chance that the two gaps coincide works out so that balanced primes below x number on the order of x / (log x)^3 times a constant - vanishingly sparse compared with the primes themselves, but still expected to be infinite in total.
The observed counts track such heuristics reasonably at the sizes computers have checked, which is the usual state of affairs in prime-pattern statistics: the finite evidence is suggestive, the proofs are absent, and the calculator's exact small-range answers are the solid ground in between.
Checking by hand
To test a prime p by hand you need only its two neighbours - the previous prime is found by stepping down through odd candidates and trial-dividing, the next the same way up. For primes in the hundreds this takes a minute; the calculator exists because doing it for a whole range, or for a six-digit prime, stops being fun quickly.
A common hand-checking error is to average the wrong pair - the primes two positions away, or a composite mistaken for a prime neighbour. The calculator's steps name the neighbours it used, so any disagreement with a hand check can be traced to exactly that step.
Balanced primes and prime gaps
A balanced prime is the midpoint of its neighbouring primes, so its existence is a statement about gap symmetry: the gaps on either side are equal. Prime gaps are usually irregular - the gap sequence jumps around its slowly growing average - and exact local symmetry is the exception, which is why balanced primes thin out as numbers grow - only 15 below 1,000, and scarcer the further out you go, because exact symmetry between two irregular gaps becomes ever less likely.
The concept pairs naturally with its one-sided cousins: a prime closer to the previous prime than to the next is sometimes called weak, and one closer to the next, strong. Every prime (beyond the smallest) is exactly one of weak, balanced or strong - a trichotomy that turns the vague question 'are primes evenly spaced here?' into a classification you can compute, which is what this page's verdict output does.
FAQs
What is a balanced prime?
A prime that is exactly the average of the prime before it and the prime after it - for example 53, the mean of 47 and 59.
Is 53 a balanced prime?
Yes. Its neighbouring primes are 47 and 59, and (47 + 59) / 2 = 53.
How many balanced primes are below 1,000?
15 - they run from 5 to 977.
What is the first balanced prime?
5, the mean of 3 and 7.
Can an even number be a balanced prime?
No. A balanced prime must first be prime, and 2 has no prime below it to average with.
Where are balanced primes catalogued?
In the OEIS, as sequence A006562.