Work

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

Year: 2026
Type: preprint
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.
Author: Miler, Jhony
Language: English
Open Access status: green
OpenAlex ID: W7238840539
Cites:
Cited by:
Related to: