#prime #number-theory #sieve #rayon #periodic-table

bin+lib prime-formula

High-performance prime number generation and constellation finding using novel wheel factorization

5 unstable releases

Uses new Rust 2024

0.3.1 May 12, 2025
0.3.0 May 12, 2025
0.2.0 May 12, 2025
0.1.1 May 7, 2025
0.1.0 May 6, 2025

#785 in Math

Download history 258/week @ 2025-05-06 174/week @ 2025-05-13 3/week @ 2025-05-20

164 downloads per month

MIT license

110KB
2K SLoC

Rust 1.5K SLoC // 0.1% comments Python 429 SLoC // 0.3% comments

prime-formula

A Rust implementation of the Formula of Primes (FOP) using insights from the Periodic Table of Primes (PTP).

Overview

For millennia, prime numbers have eluded precise prediction, their distribution remaining one of mathematics' greatest mysteries. This project implements groundbreaking research that establishes a Periodic Table of Primes (PTP) – a revolutionary framework for understanding prime numbers and their patterns.

Key Theory Foundations

  1. Periodic Table of Primes (PTP)

    • Built from the foundational primes 2, 3, 5, and 7
    • Identifies 48 critical integers within every 210-number cycle (2×3×5×7)
    • These 48 integers generate all primes and composites without factors of 2, 3, 5, or 7
  2. Formula of Primes (FOP)

    • Algorithmically generates primes, twin, triple or higher primes
    • Reveals deterministic relationships between primes and their PTP roots
  3. Counting Functions

    • Provides analytical tools for prime and twin prime distribution analysis

Features

Rust CLI & Library Implementation

  • 🚀 Generate primes using PTP's 48-root framework
  • 🔍 Analyze twin and triple prime distributions
  • 📈 Compute prime counting functions
  • ⚡ High-performance Rust implementation for:
    • Large-number theory applications
    • Cryptographic research
    • Mathematical pattern discovery

Installation

# For library use
cargo init
cargo add prime-formula  

Will initialize a new rust project and pull in the prime-formula library.

# For CLI use
cargo install prime-formula

Will install the binary locally to get started quickly.

Usage

# Generate primes using prime-formula CLI
prime-formula 0 1e6

Will count primes in the range 0 - 1,000,000.

prime-formula --dist 1e3 -c 2

Will count twin primes in the range 0 - 1,000.

prime-formula 1e12 --dist 1e3 -p

Will find primes that are at least 1×1012 in size with a window size of 1,000.

Why This Matters

This implementation bridges theoretical number theory with practical computation, offering:

  • A predictive framework for prime distribution
  • New tools for twin prime conjecture analysis
  • Efficient algorithms leveraging PTP's structural insights

References

"Each prime is an offspring of the 48 integers on the PTP – finally giving us a periodic law for primes."

Paper: Periodic Table of Primes (PTP) Theory

Dependencies

~8.5MB
~219K SLoC