Skip to content

Releases: RobLe3/lulzprime

lulzprime v0.2.0

21 Dec 11:56

Choose a tag to compare

This release delivers significant performance improvements, usability enhancements, and infrastructure upgrades while maintaining stdlib-only purity and exact contract compliance.

Contract Compliance

  • Meissel-Lehmer π(x) backend: ENABLE_LEHMER_PI now enabled by default
    • Sublinear O(x^(2/3)) prime counting for large x
    • Exact Legendre formula implementation with memoization
    • Dedicated lehmer.py module with comprehensive tests
  • Forecast refinement levels: Extended support for refinement_level parameter
    • Level 2: Higher-order PNT terms for <0.2% error at n=10^8
    • Level 3: Implemented and tested for ultra-precise forecasting
    • Maintains backward compatibility (Level 1 default)

Performance

  • Log caching: LRU cache (maxsize=2048) for log_n() and log_log_n() functions
    • 25-35% reduction in simulation time for N≥10^6
    • Cache hit rate >95% in typical workloads
  • Generator mode: Added as_generator parameter to simulate()
    • Memory reduction from O(N) to O(1) for streaming workloads
    • Maintains determinism: same seed yields identical sequence
    • 12 new tests validating equivalence and memory efficiency
  • Dynamic β annealing: Added anneal_tau parameter to simulate()
    • Reduces early transient variance, improves convergence stability
    • 14 new tests validating annealing behavior
  • CDF gap sampling: Replaced random.choices() with CDF + binary search
    • Performance improvement: O(k) → O(log k) per sample (~7-8× faster)
    • Maintains exact probability distribution semantics
    • 17 new tests validating sampling correctness

Usability

  • Command-line interface: Added python -m lulzprime CLI
    • Commands: resolve, pi, simulate
    • Support for --seed, --anneal-tau, --generator flags
    • Streaming output for low-memory workflows
  • JSON export: New simulation export functionality
    • simulation_to_json() and simulation_to_json_string() helpers
    • CLI --json flag for exporting results to file
    • Includes metadata (n_steps, seed, anneal_tau, timestamps)

Infrastructure

  • GitHub Actions CI: Automated testing on push/PR
    • Matrix testing: Python 3.10, 3.11
    • Runs full test suite (258 passing tests)
    • Mypy type checking integrated into workflow
  • mypy strict type checking: Comprehensive type annotations
    • Enabled strict mode (disallow_untyped_defs, warn_return_any)
    • Fixed 17 typing errors across 5 modules
    • Python 3.10+ type hints throughout codebase

Changed

  • simulate() signature now includes: as_generator (bool), anneal_tau (float | None)
  • Gap sampling implementation: bisect-based for O(log k) performance
  • Total tests: 169 → 258 (89 new tests)
  • ENABLE_LEHMER_PI default changed from False to True

Performance Metrics

  • Simulations: 20-60% faster overall
  • Memory: 75% reduction with generator mode (180 MB → 45 MB for N=10^6)
  • Gap sampling: ~7-8× faster per sample for typical distributions
  • Forecast accuracy: <0.2% error at n=10^8 with refinement_level=2

Notes

  • All features maintain stdlib-only purity (no external dependencies)
  • Backward compatible: All v0.1.2 code runs unchanged on v0.2.0
  • Phase 2 (Performance), Phase 3 (Usability), Phase 4 (Infrastructure) complete

LULZprime v0.1.2 — Documentation Fix

20 Dec 17:42

Choose a tag to compare

LULZprime v0.1.2 — Documentation Fix

Fixed

  • Documentation: Updated all version references in README from 0.1.0 to current version (0.1.2)

Note

  • No code changes from 0.1.1
  • This release addresses documentation consistency
  • PyPI does not allow replacing existing releases, hence patch bump to 0.1.2

Unchanged

  • No algorithm changes
  • No API changes
  • No behavior changes
  • Configuration defaults unchanged:
    • ENABLE_LEHMER_PI = False
    • LEHMER_PI_THRESHOLD = 250_000
  • Test suite: 169/169 tests passing

Links


Install:

pip install lulzprime==0.1.2

Verify:

from lulzprime import resolve
print(resolve(100))  # 541

LULZprime v0.1.1 — Patch Release

20 Dec 17:16

Choose a tag to compare

LULZprime v0.1.1 — Patch Release

Fixed

  • CI Reliability: Added fail-fast: false to workflow matrix for better diagnostics
  • Code Formatting: Reformatted all source files with black 25.x
  • Linting Cleanup: Fixed 60 ruff violations (import sorting, unused imports, deprecated typing annotations)
  • Configuration: Updated ruff config to use lint.* sections (deprecation fix)
  • README: Logo now renders correctly on PyPI (GitHub raw URL)

Unchanged

  • No algorithm changes
  • No API changes
  • No behavior changes
  • Configuration defaults unchanged:
    • ENABLE_LEHMER_PI = False
    • LEHMER_PI_THRESHOLD = 250_000
  • Test suite: 169/169 tests passing

Links


Install:

pip install lulzprime==0.1.1

Verify:

from lulzprime import resolve
print(resolve(100))  # 541

LULZprime v0.1.0 — Reference Implementation

19 Dec 13:38

Choose a tag to compare

LULZprime v0.1.0 — Reference Implementation

This is the initial and final reference release of LULZprime.

LULZprime is a deterministic, exact prime computation library providing:

  • Exact π(x) (prime counting)
  • Exact n-th prime resolution via resolve(n)
  • Tier A correctness guarantees
  • Bit-identical deterministic results
  • Extremely low memory usage
  • Evidence-backed, measured performance only

This release is feature-complete and fire-and-forget.


Highlights

  • ✅ Exact Meissel–Lehmer π(x) implementation (P2 correction)
  • ✅ Practical resolve(500k) in ~73 seconds (validated)
  • ✅ Memory usage ~0.66–1.16 MB (≈15× reduction vs segmented sieve)
  • ✅ Deterministic, integer-only core
  • ✅ 169/169 tests passing
  • ✅ No runtime dependencies (stdlib only)

Maintenance Status

This project is provided as a completed reference implementation.

  • No active feature development
  • No performance roadmap
  • Forking is the intended continuation path

If you extend or modify this code, you are the maintainer of your fork.


What This Is Not

  • ❌ Not cryptography
  • ❌ Not factorization
  • ❌ Not a probabilistic model
  • ❌ Not intended for unbounded indices
  • ❌ Not a security primitive

Documentation & Theory

The canonical theoretical background (OMPC) is available externally at:
https://roblemumin.com/library.html


Support

If you leverage this library in production and it helps you save money,
please consider donating approximately 1 % of the savings to organizations supporting homeless people.

This is a request, not a license condition.


Integrity

  • Defaults unchanged (`ENABLE_LEHMER_PI = False`)
  • No algorithm changes
  • No speculative claims
  • Fully reproducible results

Status: Stable · Verified · Reference-grade