Glossary & Sequence Reference

Definitions for every term and sequence used by the Prime Terrain Explorer, with cross-references to OEIS where applicable. Sequences marked novel are introduced by this site.

Contents

Core sequences

Prime pn

The n-th prime number, in the natural order: p1 = 2, p2 = 3, p3 = 5, …

OEIS: A000040

Prime gap gn
gn = pn+1 − pn

The distance from one prime to the next. Always even for n ≥ 2 (since all primes after 2 are odd). The first few are 1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, …

OEIS: A001223

Second difference Δ²n · d2
Δ²n = gn − gn−1 = pn+1 − 2pn + pn−1

How the gap is changing — positive when the gap is widening, negative when it is shrinking. Sums of three consecutive primes determine local "curvature" in the prime terrain.

OEIS: A036263

Second ratio rn (novel — fractal-core)
rn = Δ²n / (pn+1 − pn−1)

The second difference normalized by the surrounding span. Always lies in [−1, 1] — proof: |Δ²n| = |gn − gn−1| ≤ gn + gn−1 = pn+1 − pn−1.

rn = +1 when the right gap is much larger than the left; rn = −1 when the left is much larger; rn = 0 when both gaps are equal.

Returned as a reduced rational (num/den with gcd = 1) so the sequence is exact for arbitrary precision. No OEIS entry exists for this normalized form; it appears to be original to this project, suitable for citation as "second ratio" of the prime sequence.

Index n

The 1-indexed position of a prime in the natural ordering. Index 1 is p = 2, index 2 is p = 3, etc. Inputs to this site can be either the index or the value — a "by index" search of n=100 gives the 100th prime (541), while a "by value" search of n=100 gives the next prime ≥ 100 (which is 101).

Derived measures

Gap merit Mn
Mn = gn / ln(pn)

How impressive a gap is, normalized against the "expected" gap at that scale. The Prime Number Theorem implies the average gap near p is roughly ln(p), so the average merit converges to 1 as n grows.

A merit of 4 means the gap is 4× the local average — a noteworthy outlier. Gap-hunters in number theory search for "high-merit gaps". The current record (as of 2024) is around 41.94 by Helm, Andersen et al.

Cramér's ratio Cn
Cn = gn / ln²(pn)

Tests Cramér's heuristic, which predicts that prime gaps satisfy gn = O(ln²(pn)). The conjecture is limsup Cn = 1; current empirical evidence puts it at about 0.92.

Where merit asks "how big relative to the average," Cramér asks "how big relative to the conjectured maximum."

Residue races & Chebyshev's bias

Residue race

For a fixed modulus m, count the primes in each residue class p ≡ a (mod m), excluding the primes that divide m. As n grows, the counts in each admissible class converge (Dirichlet's theorem), but at any finite x the leader fluctuates.

Chebyshev's bias

The empirical observation, due to Chebyshev (1853), that primes ≡ 3 (mod 4) lead primes ≡ 1 (mod 4) at "almost all" finite x. The first sign change — where π(x; 4, 1) overtakes π(x; 4, 3) — occurs at x ≈ 26 861 (Bays & Hudson, 1978). The bias generalizes: among admissible residues, those that are quadratic non-residues tend to lead.

OEIS: A007350 (sign changes of π(x;4,3) − π(x;4,1))

Lead changes

The number of times the leader of a residue race switches within the queried window. Littlewood (1914) proved there are infinitely many.

Chebyshev's θ(x)

Theta function θ(x)
θ(x) = Σp ≤ x ln(p)

The sum of natural logarithms of all primes up to x. The Prime Number Theorem is equivalent to θ(x) ~ x.

More tractable than π(x) for analytic work. Under the Riemann Hypothesis, the deviation θ(x) − x is bounded by O(√x · ln²(x)). On this site, set n=1, n_type=index to start the sum at p = 2 — the only configuration where the returned total equals true θ(plast).

OEIS: A083409 (deviation θ(x) − x at integer x)

Normalized deviation (θ(x) − x) / √x

The empirically-bounded magnitude when the neighborhood actually starts at p = 2. Under RH, this stays bounded by O(ln²(x)), so values larger than that would be a Riemann-Hypothesis-disproving anomaly.

Prime constellations (k-tuples)

Constellation

A run of primes matching a fixed gap signature. Examples: twin primes have signature [2] (gap 2), cousin primes [4], sexy primes [6], prime quadruplets [2, 4, 2].

Searched here as ?signature=2,4,2&start=…&limit=… on /api/v1/constellations.

Gap signature

The list of gaps between consecutive primes in the constellation. A signature of length L matches L+1 primes. The offsets [0, g₁, g₁+g₂, …, g₁+…+gL] are the relative positions of those primes from the first.

Admissibility (Hardy–Littlewood)

A k-tuple is admissible if for every prime q, its offsets do not cover all residue classes mod q. Inadmissible tuples can occur at most finitely often. Example: signature [2, 2] gives offsets {0, 2, 4} which mod 3 is {0, 1, 2} — every class — so no triple of primes can form (p, p+2, p+4) infinitely often (excluding the single triple 3, 5, 7).

Verifiable instantly via /api/v1/constellations/admissible?signature=….

Density per Δ ln(x)

Observed count divided by the natural-log span of the queried window. Hardy–Littlewood predicts asymptotic density ∝ Π(Ck) / lnk(x) for admissible tuples; this site reports the observed density for direct comparison.

Built-in patterns

NameSignatureOEIS
twin[2]A001359
cousin[4]A023200
sexy[6]A023201
triplet (2-4)[2, 4]A022004
triplet (4-2)[4, 2]A022005
quadruplet[2, 4, 2]A007530
quintuplet[2, 4, 2, 4] / [4, 2, 4, 2]A022006 / A022007
sexy triplet[6, 6]A046118
sexy quadruplet[6, 6, 6]A046122
prime sextuplet[4, 2, 4, 2, 4]A022008

Background concepts

Prime Number Theorem (PNT)

π(x) ~ x / ln(x), or equivalently pn ~ n · ln(n). Implies the average gap near p is ≈ ln(p), and is the basis for both the merit normalization (M ≈ 1 on average) and the θ(x) ~ x expectation.

Riemann Hypothesis (RH)

The conjecture that all non-trivial zeros of the Riemann zeta function ζ(s) lie on Re(s) = ½. Equivalent to a sharp bound on PNT's error: |θ(x) − x| = O(√x · ln²(x)).

Cramér's conjecture

gn = O(ln²(pn)) — gaps grow no faster than the square of the local logarithm. Stronger than what PNT alone implies. Currently proven only conditionally (under RH, a weaker bound holds).

Engine details

BPSW (Baillie-Pomerance-Selfridge-Wagstaff)

The primality test used by this site for any value beyond the precomputed sieve. Combines a Miller–Rabin test with base 2 and a strong Lucas test. No counterexamples are known despite testing against many trillions of candidates; widely accepted as practically deterministic for the bit-sizes this site supports.

Wheel sieve (mod 30030)

Before running BPSW on a candidate, we skip any integer that shares a small prime factor with W = 2 · 3 · 5 · 7 · 11 · 13 = 30 030. Of the 30 030 residues only 5 760 are coprime to W, so 80.8 % of composite candidates are eliminated essentially for free — a 5× speedup on nextPrime walks.

Kahan summation

Compensated floating-point summation used when accumulating ln(p) for θ(x). Tracks the running rounding error so the sum stays accurate over thousands of terms.

lnBigInt

For primes beyond Number.MAX_SAFE_INTEGER (~9 × 10¹⁵), the naïve Math.log(Number(bigint)) loses precision. Our replacement decomposes ln(n) = (digits − 1) · ln(10) + ln(leading 15 digits / 10¹⁴), preserving ~14 significant digits at any magnitude.