There is a newer version of the record available.

Published June 2, 2026 | Version v4
Software Restricted

Pythagorean Modular Prime Sieve – C++ Reference Implementation

Authors/Creators

Description

C++ reference implementation of the Pythagorean modular prime sieve operating on the inradius index r, with optional OpenMP parallelism and batch or pure streaming APIs. The software is designed for memory-efficient prime generation and direct access to distant prime ranges.

This repository provides an industrial-grade C++ implementation of the **Pythagorean modular prime sieve**, a novel prime generation method introduced by Roberto Amato.

The algorithm is based on a modular reformulation of divisibility arising from Pythagorean geometry. Odd integers are parametrized as

$$
x = 2r + 1,
$$

and composite values are excluded through a single congruence condition on the index $r$. For any odd divisor $d \geq 3$, one has

$$
x \text{ divisible by } d
\;\Longleftrightarrow\;
r \equiv \frac{d - 1}{2} \pmod{d}.
$$

Each odd divisor eliminates exactly one residue class modulo $d$, yielding a sparse modular sieve with reduced memory requirements.

This formulation naturally supports segmentation, parallel execution, and streaming prime generation, and enables direct access to primes located far from the origin without storing all preceding values.

Notes

If you use this software, please cite it as below.

Files

Restricted

The record is publicly accessible, but files are restricted. Log in to check if you have access.

Additional details

Related works