primePy
This module contains several useful functions to work with prime numbers. from primePy import primes
What it is and what it does
primePy is a pure-Python module for prime number operations: testing primality, extracting prime factors with multiplicity, generating sequences of primes, and computing Euler's totient function. It exposes a simple API through the `primes` module with methods like `check()`, `factor()`, `factors()`, `first()`, `upto()`, `between()`, and `phi()`. The package has no external runtime dependencies and installs as a single wheel.
The module was designed for reasonable performance on moderate-sized integers (demonstrated on numbers up to around 10^14 and factorizations completing within seconds). However, the package has been abandoned since its single release on 2018-05-29, with no maintenance, bug fixes, or compatibility updates for modern Python environments. It remains functional for basic number-theoretic tasks but carries the risk of incompatibility with future Python versions and no recourse for issues.
Use it for:
- Educational projects or scripts that need basic primality testing and factorization without external dependencies
- Cryptographic prototyping or number-theory experiments where you need quick prime generation and Euler's totient
- Competitive programming or mathematical problem-solving requiring fast prime enumeration up to moderate bounds
- Legacy systems or offline environments where a self-contained, dependency-free prime utility is preferred
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides functions to test primality, factor integers, generate prime sequences, and compute Euler's totient function for mathematical and cryptographic applications.
Yes, with strong conditions. Install only if you need a lightweight, dependency-free prime utility for educational or experimental use and can tolerate the lack of maintenance. The MIT license and low install friction are advantages, and no known vulnerabilities exist. However, do not use in production or long-term projects—the package is abandoned, and there is no guarantee of compatibility with current or future Python versions. For active development, consider a maintained alternative.
Install
primepy on PyPI
pip
pip install primepyuv
uv add primepypoetry
poetry add primepyInstalling primePy
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last release and commit were in 2018, with no maintenance activity for years. Use only if you need a stable, self-contained prime utility and can accept no future updates or bug fixes.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute freely with minimal restrictions. No licensing barrier to adoption.
Quickstart
pip install primePy
from primePy import primes
# Check if a number is prime
print(primes.check(79012338765433))
# Get all prime factors with multiplicity
print(primes.factors(252))
# Get first n primes
print(primes.first(7))
# Get all primes up to n
print(primes.upto(16))
# Get primes between m and n
print(primes.between(100, 200))
# Compute Euler's totient
print(primes.phi(128))
Verify before relying
- Whether the package handles edge cases (negative numbers, zero, one) as documented
- Performance characteristics on modern hardware and Python versions beyond the 2018 test environment
- Compatibility with Python versions released after 2018 despite 'Programming Language :: Python :: 3' classifier
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,999 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,138,753/month — #3,261 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: primePy-1.3-py3-none-any.whl
Keywords: fast, prime, facorization, Eular phi, prime check
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
fprime-visualA browser-based web application for visualizing…
permissive · top 15,000 on PyPI
permutationProvides a Permutation class for representing…
permissive · top 15,000 on PyPI
fprime-fppFPP is a modeling language and compiler for the…
permissive · top 15,000 on PyPI
pyudorandomGenerates pseudorandom numbers using algebraic…
unclear · top 15,000 on PyPI
primeCLI and Python SDK for managing GPU compute,…
permissive · top 15,000 on PyPI
galoisGalois extends NumPy arrays to perform…
permissive · top 15,000 on PyPI
fprime-toolsProvides command-line tools and utilities for…
permissive · top 15,000 on PyPI
paretosetComputes the Pareto (non-dominated) set from…
permissive · top 15,000 on PyPI
lighteccLightECC provides elliptic curve arithmetic…
permissive · top 15,000 on PyPI
cysignalsProvides interrupt and signal handling…
copyleft · top 15,000 on PyPI