Find Primes is a library to find all kinds of primes and factors of big numbers.
Install
Stable Version:
pip install -U find-primes
Beta Version:
pip install --pre -U find-primes
Find all primes below a number
Example: Find all primes below 100.
from find_primes import all_primes
print(all_primes(100, 'list'))
Check if a number is a prime
Example: Check if 189765 is a prime.
from find_primes import is_prime
print(is_prime(189765))
Factor a big number
Example: Factor 2776889953055853600532696901.
from find_primes import factor_mpqs
print(factor_mpqs(2776889953055853600532696901))
The CLI Tool
Usage:
find_primes.py --help
A twin prime is a prime number that is either 2 less or 2 more than another prime number.
Example: Find all twin primes below 1000.
from find_primes import find_twins
print(find_twins(1000))
A palindrome prime is a prime number that is also a palindrome number.
Example: Find all palindrome primes below 1000.
from find_primes import find_palindromes
print(find_palindromes(1000))
Example: Find all palindrome primes below 1000 in base 2.
from find_primes import find_palindromes_base_2
print(find_palindromes(8200)) #return in base 10
An emirp is a prime number that results in a different prime when its decimal digits are reversed.
Example: Find all emirps below 1000.
from find_primes import find_reverses
print(find_reverses(1000))
Primes in Arithmetic Progression
Primes in arithmetic progression are any sequence of at least three prime numbers that are consecutive terms in an arithmetic progression.
Example: Find all primes in arithmetic progression below 1000.
from find_primes import find_arithmetic_prime_progressions
print(find_arithmetic_prime_progressions(100))
A mersenne prime is a prime number that is one less than a power of two.
Example: Find all mersenne primes below 600000.
from find_primes import find_mersenne
print(find_mersenne(600000))
A double mersenne prime is a double mersenne number that is prime.
Example: Find all double mersenne primes below 130.
from find_primes import find_double_mersennes
print(find_double_mersennes(130))
A fermat pseudoprime is a pseudoprime that satisfies fermat's little theorem.
Example: Find all fermat pseudoprimes below 1000.
from find_primes import find_fermat_pseudoprimes
print(find_fermat_pseudoprimes(1000))
A balence prime is a prime number which is equal to the arithmetic mean of the nearest primes above and below.
Example: Find all balence primes below 1000.
from find_primes import find_balences
print(find_balences(1000))
A carol prime is a carol number that is prime.
Example: Find all carol primes below 4000.
from find_primes import find_carols
print(find_carols(4000))
A fibonacci prime is a fibonacci number that is prime.
Example: Find all fibonacci primes below 1000.
from find_primes import find_fibonaccis
print(find_fibonaccis(1000))
A left-truncatable prime is a prime number which remains prime when the leading digit is successively removed.
Example: Find all left-truncatable primes below 140.
from find_primes import find_truncates
print(find_truncates(140, LEFT))
A right-truncatable prime is a prime number which remains prime when the last digit is successively removed.
Example: Find all right-truncatable primes below 295.
from find_primes import find_truncates
print(find_truncates(295, RIGHT))
A left-and-right-truncatable prime is a prime number which remains prime when the leading and last digits are simultaneously successively removed.
Example: Find all left-and-right-truncatable primes below 3800.
from find_primes import find_truncates
print(find_truncates(3800, BOTH))
A cuban prime is a prime number that is a solution to a specific equation involving third powers of x and y.
Example: Find all cuban primes below 440.
from find_primes import find_cubans
print(find_cubans(440))
A centered triangular prime is a prime number and a centered figurate number that represents a triangle with a dot in the center and all other dots surrounding the center in successive triangular layers.
Example: Find all centered triangular primes below 1000.
from find_primes import find_center_polygons
print(find_center_polygons(1000, TRIANGLE))
A centered square prime is a prime number and a centered figurate number that represents a square with a dot in the center and all other dots surrounding the center in successive square layers.
Example: Find all centered square primes below 1000.
from find_primes import find_center_polygons
print(find_center_polygons(1000, SQUARE))
A centered pentagonal prime is a prime number and a centered figurate number that represents a pentagon with a dot in the center and all other dots surrounding the center in successive pentagonal layers.
Example: Find all centered pentagonal primes below 1000.
from find_primes import find_center_polygons
print(find_center_polygons(1000, PENTAGON))
A centered hexagonal prime is a prime number and a centered figurate number that represents a hexagon with a dot in the center and all other dots surrounding the center in successive hexagonal layers.
Example: Find all centered hexagonal primes below 1000.
from find_primes import find_center_polygons
print(find_center_polygons(1000, HEXAGON))
A centered heptagonal number is a prime number and a centered figurate number that represents a heptagon with a dot in the center and all other dots surrounding the center in successive heptagonal layers.
Example: Find all centered heptagon primes below 1000.
from find_primes import find_center_polygons
print(find_center_polygons(1000, HEPTAGON))
A wieferich prime is a prime p that divides
.
Example: Find all wieferich primes below 4000.
from find_primes import find_wieferiches
print(find_wieferiches(3515))
A wilson prime is a prime p that divides
.
Example: Find all wilson primes below 565.
from find_primes import find_wilsons
print(find_wilsons(565))
A happy prime is a prime that is a happy number.
Example: Find all happy primes in base 10 below 195.
from find_primes import find_happys
print(find_happys(195))
A Pierpont prime is a prime of the form .
Example: Find all pierpont primes below 770.
from find_primes import find_pierponts
print(find_pierponts(770))
A leyland prime is a leyland number that is a prime.
Example: Find all leyland primes below 33000.
from find_primes import find_leylands
print(find_leylands(33000))
Leyland Primes of a Second Kind
A leyland prime of a second kind is a leyland number of a second kind that is a prime.
Example: Find all leyland primes of a second kind below 58050.
from find_primes import find_leylands_second_kind
print(find_leylands_second_kind(58050))
A woodall prime is a woodall number that is a prime.
Example: Find all woodall primes below 400.
from find_primes import find_woodalls
print(find_woodalls(400))
A unique prime is a prime that there is no other prime q such that the period length of the decimal expansion of its reciprocal, 1 / p, is equal to the period length of the reciprocal of q, 1 / q.
Notice: You must install mpmath to find unique primes.
Example: Find all unique primes below 105.
from find_primes import find_uniques
print(find_uniques(105))
A friedman prime is a friedman number that is a prime.
Example: Find all friedman primes below 128.
from find_primes import find_friedmans
print(find_friedmans(128))
The Multiple Polynomial Quadratic Sieve (MPQS) method is a factorization method.
Example: Factor a big number.
from find_primes import factor_mpqs
print(factor_mpqs(277688995305593400532696901))
The Self-initializing Quadratic Sieve (SIQS) method is a factorization method based on the Multiple Polynomial Quadratic Sieve (MPQS) method.
Example: Factor a big number.
from find_primes import factor_siqs
print(factor_siqs(3458280484189))
The Lenstra Elliptic-curve method is a factorization method.
Example: Factor a big number.
from find_primes import factor_lenstra
print(factor_lenstra(2854159729781))
The Pollard p - 1 method is a factorization method.
Example: Factor a big number.
from find_primes import factor_pollardpm1
print(factor_pollardpm1(2854159729781))
The Williams p + 1 Method is a factorization method.
Example: Factor a big number.
from find_primes import factor_williamspp1
print(factor_williamspp1(2854159729781))
Metadata
Release files for find-primes 2.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| find_primes-2.2.1.tar.gz | 42.2 kB | Without provenance | Details for find_primes-2.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| find_primes-2.2.1-py3-none-any.whl | Python 3 | none | any | Details for find_primes-2.2.1-py3-none-any.whl |
Total release size: 83.8 kB
Release files / find_primes-2.2.1.tar.gz
| Download URL | find_primes-2.2.1.tar.gz |
|---|---|
| Size | 42.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15711cbc6843c42fb08356cc3610275f0b5669b93b8da03d635894d78531aff7
|
|
BLAKE2b-256 checksum How to use checksums |
0a2caa245dda900c01d0332063e1dc7f75d94042998527abae72652d3ab05894
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|
Release files / find_primes-2.2.1-py3-none-any.whl
| Download URL | find_primes-2.2.1-py3-none-any.whl |
|---|---|
| Size | 41.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40bb42f7fc4b63924650ad40063811d46a4c033a637201319f54dc20e279afad
|
|
BLAKE2b-256 checksum How to use checksums |
cc9ff6a9d2cdf2092ef35f0c4297d38852b551380dd26a35c874117fa3510cfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|
Security for find-primes 2.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.