Primetheus is a high-performance, memory-efficient, and multithreaded prime counting engine.
It calculates the number of primes up to 10¹² in ~188 seconds using only 13 MB RAM throughout the entire generation.
Built with pure C++, low-level memory control, and raw performance in mind. And LOVE of GOD
- ⚙️ Bitpacked Segment Sieving – Ultra-efficient memory usage
- 🧵 Multithreaded (32 threads in my case) – Fully parallelized across CPU cores
- 🧮 Custom Integer Square Root – No floating-point inaccuracies, therefore little less affected by already running applications
- 🧱 Wheel-30 Filtering – Filters ~73% of composites before sieving
- 💾 Fixed RAM footprint (~13 MB) – No heap growth during execution
- 🔐 Licensed under SSPL – For controlled, transparent use
| Input Range | Threads | Time | RAM Usage | Prime Count | Accuracy |
|---|---|---|---|---|---|
| 10¹² | 32 mycase | ~188 sec | ~13 MB | 37,607,912,018 | ✅ Exact |
Benchmarked on an AMD Ryzen 3950X system
- Clone the repository
git clone https://github.com/Rick-laboratory/Primetheus.git - Open
Primetheus.vcxprojin Visual Studio - Select Release x64
- Build & run
✅ No .sln required
✅ No external libraries
✅ No bullshit
Because too much modern code is bloated, abstracted, and inefficient.
Primetheus proves you can:
- Process trillion-scale input
- With megabyte-static memory
- At CPUs-native speed
It's my personal engineering testament.
We don’t overuse memory. We don’t overuse abstractions.
We respect the system. And it repsects us.
SSPL (Server Side Public License)
Use is permitted with conditions. Redistribution and modification require full compliance.
See LICENSE for details.
Built by Rick Armbruster
For questions, licensing, or performance consulting:
📫 LinkedIn
Try building this on Linux using g++ with -std=c++20 -O3 -march=native -pthread
If you beat the current benchmark, let me know. 😎
- SIMD acceleration (optional AVX2 build)
- Extended output (store primes / diffs)
- Cross-platform benchmarks
- Binary distribution
If your threat model includes "counting to 10^512 to crack encryption", please consult a cryptographer or take a nap.
"Built because the world needed a smarter sieve.
This project is licensed under the Server Side Public License v1 (SSPL).
See the LICENSE file for details.
