The information cost of the next prime: an entropy law for sieve-based prime generation

How many bits must each prime cost? Prime-representing constants (e.g. Fridman et al., 2019) store the whole sequence of primes in the digits of one real number. We give an explicit heuristic law for the minimum cost per prime, and a working implementation. The law. For a decoder that knows the residues of its position modulo all primes q ≤ B and must be told which surviving B-rough candidate is the next prime, the cost is h(1/L(x,B)) bits per prime, where: L(x,B) = ln x · ∏q≤B(1 − 1/q) · eγ · ω(ln x / ln B) is the expected number of B-rough integers per prime gap (ω is Buchstab's function); h(q) is the entropy of a geometric variable with success probability q. Evidence. L matches direct counts to within 0.5% on about 1.15·105 prime gaps near 109–1014. h(1/L) matches real code lengths to within 3.3% for 106 ≤ x ≤ 1014, and is within 0.002 bits of the best memoryless code. Trade-off between sieve memory and information near 1014: 3.95 bits per prime at B = 13, 2.51 at B = 103, 1.51 at B = 105, and 0 at B = √x. Implementation (κM). A parameter-free arithmetic-coded constant: an entropy-coded mod-30030 wheel bitmap. A byte-exact rANS implementation uses 2.14–3.24 bits per prime, within 0.07 bits of the law. That is 13–34% smaller than adaptive gap coders conditioned on residues, and 12–18% smaller than the uncompressed wheel bitmap near 109, with block-level random access. Limits. The laws are heuristic, not proven. κM is smallest among the formats tested, not a proven optimum, and a sieve regenerates primes faster than κM decodes them: the gain is in space. Code and data: github.com/jhonymiler/prime-information-law (MIT). Every number in the paper is reproducible from the included scripts. Interactive results page: jhonymiler.github.io/prime-information-law.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-24
DOI
https://doi.org/10.5281/zenodo.24485480
Primary Topic
Analytic Number Theory Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

The information cost of the next prime: an entropy law for sieve-based prime generation

Jhony Miler
Zenodo (CERN European Organization for Nuclear Research)
Analytic Number Theory Research
preprint

The information cost of the next prime: an entropy law for sieve-based prime generation

Jhony Miler
preprint en

Abstract

How many bits must each prime cost? Prime-representing constants (e.g. Fridman et al., 2019) store the whole sequence of primes in the digits of one real number. We give an explicit heuristic law for the minimum cost per prime, and a working implementation. The law. For a decoder that knows the residues of its position modulo all primes q ≤ B and must be told which surviving B-rough candidate is the next prime, the cost is h(1/L(x,B)) bits per prime, where: L(x,B) = ln x · ∏q≤B(1 − 1/q) · eγ · ω(ln x / ln B) is the expected number of B-rough integers per prime gap (ω is Buchstab's function); h(q) is the entropy of a geometric variable with success probability q. Evidence. L matches direct counts to within 0.5% on about 1.15·105 prime gaps near 109–1014. h(1/L) matches real code lengths to within 3.3% for 106 ≤ x ≤ 1014, and is within 0.002 bits of the best memoryless code. Trade-off between sieve memory and information near 1014: 3.95 bits per prime at B = 13, 2.51 at B = 103, 1.51 at B = 105, and 0 at B = √x. Implementation (κM). A parameter-free arithmetic-coded constant: an entropy-coded mod-30030 wheel bitmap. A byte-exact rANS implementation uses 2.14–3.24 bits per prime, within 0.07 bits of the law. That is 13–34% smaller than adaptive gap coders conditioned on residues, and 12–18% smaller than the uncompressed wheel bitmap near 109, with block-level random access. Limits. The laws are heuristic, not proven. κM is smallest among the formats tested, not a proven optimum, and a sieve regenerates primes faster than κM decodes them: the gain is in space. Code and data: github.com/jhonymiler/prime-information-law (MIT). Every number in the paper is reproducible from the included scripts. Interactive results page: jhonymiler.github.io/prime-information-law.

Zenodo (CERN European Organization for Nuclear Research)
Analytic Number Theory Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon