The Sieve of TimoEratosthenes: an incremental, division-free prime sieve on the line y = 2x + 1
The Sieve of TimoEratosthenes is an incremental algorithm for generating prime numbers by walking the line y = 2x + 1. For each prime p, the algorithm maintains a single value, ForwardX, representing the next position at which an odd multiple of p occurs. A candidate is composite if one or more ForwardX values reach its position. Otherwise, it is prime. Each prime advances its ForwardX by p. The algorithm generates primes incrementally without requiring a predefined upper limit. It uses addition and comparison in its main loop, with one multiplication when a new prime is discovered. It can be stopped, saved and resumed. This paper presents the mathematical formulation, a proof of correctness, a circular bucket-array implementation, a postponed variant with resumable state, and a wheel optimization that skips multiples of 3, 5 and 7. An open-source C# implementation is verified against independent reference calculations and benchmarked against classic, segmented and trial-division methods. The results show that the Sieve of TimoEratosthenes offers an alternative approach to prime generation, particularly when incremental operation, resumability and low memory consumption are important.
Authors
- Timo Kinnunen
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-08
- DOI
- https://doi.org/10.5281/zenodo.24056002
- Primary Topic
- Analytic Number Theory Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00