Interprime Calculator

Number Theory

Interprime resultYes - interprime
Previous prime13
Next prime17
Midpoint15
How this was calculated
  1. The prime below 15 is 13 and the prime above is 17.
  2. Their midpoint is (13 + 17) / 2 = 15.
  3. An interprime is a composite number sitting exactly at that midpoint: 15 = 15.
  4. Verdict: 15 is an interprime.

Between two consecutive primes there is a midpoint, and sometimes a whole number sits exactly on it. Such a number - composite by definition, and exactly the average of the prime before and the prime after - is called an interprime. The sequence starts 4, 6, 9, 12, 15, 18, 21, 26: 15, for example, is the midpoint of 13 and 17.

Test mode checks one number: the calculator brackets it with the neighbouring primes and compares their mean. List mode sweeps a range - up to 100 there are 24 interprimes, the largest being 99. Note what the test is not: an interprime is never prime itself, so primes are rejected on sight, and composites that are not at the exact midpoint fail too.

Interprimes are the mirror image of balanced primes, which this site also covers. A balanced prime is a prime at the centre of its neighbours; an interprime is a composite at the centre of its bracketing primes. The same prime gaps generate both sequences, read from opposite sides.

A quick experiment the list mode makes easy: compare the interprimes with the odd composites. Many odd composites are interprimes (9, 15, 21) - but not all: 25 and 27 both fail, because both are bracketed by 23 and 29, whose midpoint is 26. A single prime gap can 'adopt' only its own midpoint, and the composites off-centre - however close - are left out.

Worked examples

Is 15 an interprime?

(Test a value · 15)

Interprime resultYes - interprime
Previous prime13
Next prime17
Midpoint15

Is 14 an interprime?

(Test a value · 14)

Interprime resultNo - not an interprime
Previous prime13
Next prime17
Midpoint15

Interprimes up to 100

(List values · 100)

Interprime result24 interprimes
First five4, 6, 9, 12, 15
Largest in range99

Midpoints of prime gaps

For a composite n with previous prime p and next prime q, n is an interprime exactly when p + q = 2n. Since p and q are both odd (once past the prime 2), p + q is always even, so the midpoint of every prime gap is a whole number. But a gap contains many composites and only one midpoint - only the number sitting exactly on that centre point qualifies.

The small cases show the texture: the gap 3-5 has midpoint 4, an interprime; 5-7 gives 6; 7-11 gives 9; 11-13 gives 12; 13-17 gives 15. Even a gap of exactly 2 - twin primes - has a whole-number midpoint, and that midpoint is an interprime whenever it is composite, as 12 between 11 and 13 shows.

Worked checks - and a near miss

15 passes cleanly: previous prime 13, next prime 17, midpoint 15. 14 is the instructive failure: its bracketing primes are also 13 and 17, whose midpoint is 15, not 14 - so 14, although sitting between the same two primes, is not an interprime. Proximity is not enough; the definition demands the exact centre.

That near-miss pair is worth remembering because it is the commonest misconception about the sequence. In any prime gap wider than 2 there are several composites, but at most one of them - the exact midpoint, when the gap is even - can be an interprime.

Counting interprimes

Up to 100 there are 24: 4, 6, 9, 12, 15, 18, 21, 26, 30, 34, 39, 42, 45, 50, 56, 60, 64, 69, 72, 76, 81, 86, 93 and 99. The density is governed by the distribution of even prime gaps: every even gap of width 2m contributes its midpoint as an interprime candidate, and the candidate is automatically composite unless it equals an endpoint.

List mode performs the same bracketing test for every composite in range, so its output is exact - no heuristics, no probable primes. The counts grow steadily but irregularly, tracking the lumpiness of prime gaps themselves.

Interprimes versus balanced primes

The two sequences are dual views of one object: the sequence of prime gaps. A balanced prime occurs when two consecutive gaps are equal, centred on a prime. An interprime occurs inside a single gap, at its centre, and is composite. Every interprime 'belongs' to one gap; every balanced prime 'belongs' to a pair of adjacent gaps.

Trying both calculators on the same neighbourhood is a good way to build intuition: around 13-17 you find the interprime 15 but no balanced prime (13's neighbours are 11 and 17, mean 14; 17's are 13 and 19, mean 16). The primes around there are all slightly off-centre, while their gap centres are populated.

Parity and structure

Interprimes can be even or odd. The even members include 4, 6, 12 and 18; the odd members include 9 (between 7 and 11), 15 (between 13 and 17) and 21 (between 19 and 23). Nearby numbers miss out for purely positional reasons: 25, for instance, is bracketed by 23 and 29, whose midpoint is 26 - so 26 is the interprime and 25 is not. There is no simple parity rule, which is part of the sequence's charm.

Nor does position constrain factorisation: 15 = 3 x 5, 26 = 2 x 13 and 99 = 9 x 11 are all interprimes with nothing in common arithmetically. Being an interprime is a fact about where a number lives among the primes, not about what it is made of - which is precisely why the sequence is a statement about prime gaps rather than about composites.

Where interprimes are catalogued

The sequence is OEIS A024675. It is a recreational sequence rather than a research object - no deep conjectures attach to interprimes - but it is a clean example of how a one-line definition generates a sequence whose statistical behaviour still requires the deep theory of prime gaps to describe.

If you are exploring, try listing up to a few thousand and comparing the count against the balanced primes over the same range: interprimes are far more numerous, because gaps are plentiful while perfectly balanced primes are not.

Interprimes in wide gaps

As prime gaps widen, their midpoints become large composites with room for company: the gap from 113 to 127 has midpoint 120, an interprime with many neighbours in the same gap that are not. Wide gaps are where interprimes hide in plain sight - every record prime gap contributes exactly one interprime at its centre, a small consolation prize for the gap hunters.

Conversely, in the dense small-prime region the gaps are so narrow that midpoints arrive in quick succession - 4, 6, 9, 12, 15, 18 - giving the sequence its deceptively regular start before the gaps stretch and the interprimes space out.

A note on definitions

A few sources define 'interprime' slightly differently - for instance, requiring the number to be the average of two consecutive primes without insisting it be composite. Under that looser usage a prime could qualify only if it were the midpoint of its neighbours... which is exactly a balanced prime, and the two sequences would overlap. The strict definition used here - composite midpoints only - keeps the sequences disjoint and matches the OEIS usage.

When comparing values across sources, that definitional fork is the first thing to check, ahead of suspecting an arithmetic error.

Interprimes in the composite landscape

Interprimes are a useful counterweight to prime-centric thinking: they show that the composite numbers have their own fine structure, imposed by the primes around them. An interprime is a composite that is 'claimed' by two primes symmetrically - and the parity argument (every interprime above 4 is even, since it averages an odd prime pair) shows how rigidly the primes' own parity constrains the composites between them.

They also make a clean classroom example of a definition that must be checked, not assumed: 14 looks plausible as an interprime - it sits between 13 and 17 - until the average is actually computed and lands on 15. The calculator exists in that gap between plausible and verified, which is where a good deal of elementary number theory lives.

FAQs

What is an interprime?

A composite number that is exactly the average of the prime before it and the prime after it - 15, for example, is the midpoint of 13 and 17.

Is 15 an interprime?

Yes - it sits exactly halfway between 13 and 17.

Is 14 an interprime?

No - its bracketing primes 13 and 17 have midpoint 15, not 14.

How many interprimes are below 100?

24, running from 4 up to 99.

Can a prime be an interprime?

No - interprimes are composite by definition.

What is the first interprime?

4 - the midpoint of 3 and 5.

Sources

Related calculators

Prime Number Checker
Is it prime? The verdict, the full prime factorization, the smallest factor, the divisor count and the neighbouring primes on both sides.
Prime Factorization Calculator
Break any whole number up to a trillion into its prime factors — with divisor count, divisor sum and largest prime factor.
Aliquot Sequence Calculator
Trace an aliquot sequence to its fate: termination at 0, a perfect fixed point, or an amicable or sociable cycle.