Short Recurrences and Straight-Line Programs for Primes
Joseph M. Shunia, Mihai Prunescu
Key points
From the paper's conclusion- We express these constructions as straight-line programs using addition, truncated subtraction, multiplication, integer division, exponentiation, and remainder.
Abstract
We give a short autonomous recurrence that generates every odd prime, in increasing order, from the single initial value $8$. Its integer state determines both its output and its next update: the lowest set bit gives the next prime, while the highest set bit determines the sieve period. The same state also determines the following prime gap. A related recurrence represents the prime-counting function as the $2$-adic valuation of a single integer. Independently, a direct packing of a finite divisor sieve yields fixed arithmetic constructions for the $n$-th prime, the prime-counting function, and the twin-prime counting function. We express these constructions as straight-line programs using addition, truncated subtraction, multiplication, integer division, exponentiation, and remainder. Counting operations with reuse of computed values gives programs of lengths $166$, $132$, and $167$, respectively; one autonomous recurrence update uses $99$ operations. Explicit arithmetic subroutines remove all auxiliary operations, including bitwise AND. The programs unfold into fixed arithmetic terms without variable-length sums, products, or searches.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Unconditional Subexponential Arithmetic Circuits\ for Positive Factorial MultiplesarXiv · 2026
- Automatic $n$-dimensional recurrences over finite $p$-groups with negative predecessor coordinatesarXiv · 2026
- On the distribution of the minimal length of addition chainsarXiv · 2026
- Discrete dynamics of Eratosthenes sievearXiv · 2026
- Deterministic Polynomial-Time Primality Testing with a Single Binomial CongruencearXiv · 2026
- Discrete dynamics of Eratosthenes sievearXiv · 2026