News for hackers. Stuff that matters.

Show HN: Primeward – Exploring a stateful recurrence for the next prime

I started with a question: can we advance from prime to prime by updating a reusable arithmetic state, somewhat like a more involved Fibonacci recurrence?

Primeward is a Python research prototype exploring that idea. It builds on established next-prime formulas: extract the immediate next prime from the current state, incorporate that prime, and repeat. A finite mathematical bound and interval arithmetic allow the implementation to recover an exact integer.

The construction does not depend on the Riemann Hypothesis. It does use the Riemann zeta function and Euler products; no assumption about the location of the zeta function’s nontrivial zeros is required.

The repository includes the implementation, an optimized variant, independent correctness tests, sieve baselines, and recorded experiments. The current approach is expensive and slower than the sieve baselines. The research question is how much we can reduce the arithmetic history and numerical precision needed to initialize, update, and decode the state while preserving exact results.

I’m interested in related work and ideas for reducing those costs.

https://github.com/alexhraber/primeward

( no comments | on HN )

There are no comments yet.