Ultra-fast odd-only prime lookup with memory-mapped cache
Project description
lookprime
Ultra-fast odd-only prime lookup using a byte mask, with memory-mapped cache.
Install
pip install lookprime
CLI
Build (writes to cache by default):
lookprime build --limit 100000000
Benchmark (uses cached mask if present; otherwise builds & caches):
lookprime benchmark --limit 100000000 --duration 1.0 --iterations 25
Benchmark using a specific mask file:
lookprime benchmark --mask /path/to/lookprime_mask_100000000.lpm
Python Usage
from lookprime import open_mask, sieve_to_cache, count_primes_for_duration
path = sieve_to_cache(100_000_000) # build or reuse cache
mask = open_mask(path) # mmap open
hits, max_n = count_primes_for_duration(mask, duration=1.0, start_n=1, chunk=32768)
print(hits, max_n)
mask.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lookprime-0.1.1.tar.gz
(8.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
lookprime-0.1.1-py3-none-any.whl
(10.4 kB
view details)
File details
Details for the file lookprime-0.1.1.tar.gz.
File metadata
- Download URL: lookprime-0.1.1.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeeeb5eb73d2ac8ee19dc56c8af913bde9a2b77d96cf1465659faf62e927fe23
|
|
| MD5 |
932b3d4bd004c91a5414b64510099975
|
|
| BLAKE2b-256 |
97e33e1330a5fc030c9e53fdb1b47d34218b9b4288157ad3ac4bdc7ea2a9e098
|
File details
Details for the file lookprime-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lookprime-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6145b3aa78d4700d4f92310175f806458b87b5bcbca2916e67c6c9a2f63841bc
|
|
| MD5 |
ef51fddd24995dcf5180bc83a479a35a
|
|
| BLAKE2b-256 |
b60ac561d522e3cf8b87bb21c20a0de6245a1761ac50d4fffaab49c55f682f56
|