This official documentation of python prime library.
- Generate Specific type of Prime numbers between given range
- Generate Random Prime number
- Factorization of given number
Use pip3 if you are using python version 3+ else follow same steps as mentioned below
- If you don’t have pip then follow below procedure else go to step 2.
- For window Users
- Download get-pip to a folder on your computer.
- Put that file on Desktop
- Open cmd and run the following commands:
$ cd Desktop $ python get-pip.py
- For Mac Users
- Install python
$ brew install python
- Run the following command:
$ python get-pip.py
- Install python
- For Linux Users
- Run the following commands for python(version > 2.0):
$ sudo apt-get install python-pip $ sudo pacman -S python2-pip $ sudo yum upgrade python-setuptools $ sudo yum install python-pip python-wheel $ sudo dnf upgrade python-setuptools $ sudo dnf install python-pip python-wheel $ sudo zypper install python-pip python-setupt ools python-wheel
- Run the following commands for python(version > 3.0):
$ sudo apt-get install python3-pip $ sudo pacman -S python-pip $ sudo yum install python3 python3-wheel $ sudo dnf install python3 python3-wheel $ sudo zypper install python3-pip python3-setu ptools python3-wheel
- Run the following commands for python(version > 2.0):
- For Raspberry Users
- Run the following commands for python(version > 2.0):
$ sudo apt-get install python-pip
- Run the following commands for python(version > 2.0):
$ sudo apt-get install python3-pip
- Run the following commands for python(version > 2.0):
- Import gmpy2 file
- This package is require to install primelibpy library
- Run following command
$ pip install gmpy2==2.1.0a2
OR if you are using Python 3
$ pip3 install gmpy2==2.1.0a2
- Now, install prime python library using below command.
- Run following command
$ pip install primelibpy
- Run following command
In all the prime numbers Start_Limit and End_Limit are the range of prime number user wants to print inclusively.
Syntex:
getBalancedPrime(startLimit,endLimit,balancedMode)
Return Type:list
Description: Balanced_Mode is how number which decide balanced limit for prime.
Syntex:
getCircularPrime(startLimit,endLimit)
Return Type:list
Syntex:
getCousinPrime(startLimit,endLimit)
Return Type:list
Description: Cousin prime are in pair so return list is have list inside it e.g.[ [1,2], [2,3] ]
Syntex:
getDoubleMersennePrime(startLimit,endLimit)
Return Type:list
Syntex:
getFactorialPrime(startLimit,endLimit)
Return Type:list
Syntex:
getGoodPrime(startLimit,endLimit)
Return Type:list
Syntex:
getMersennePrime(startLimit,endLimit)
Return Type:list
Syntex:
getPalindromicPrime(startLimit,endLimit)
Return Type:list
Syntex:
getPermutablePrime(startLimit,endLimit)
Return Type:list
Syntex:
getPrimorialPrime(startLimit,endLimit)
Return Type:list
Syntex:
getFermatPseudoPrime(baseNumber,noPsedoPrime)
Return Type:list
Description: Base_number is halp to generate composite number ,and second argument is Total number of Pseudo primes
Syntex:
getPythagoreanPrime(startLimit,endLimit)
Return Type:list
Syntex:
getReversiblePrime(startLimit,endLimit)
Return Type:list
Syntex:
getSemiPrime(startLimit,endLimit)
Return Type:list
Syntex:
getSophieGermainPrime(startLimit,endLimit)
Return Type:list
Syntex:
getTwinPrime(startLimit,endLimit)
Return Type:list
Description: Twin prime are in pair so return list is have list inside it e.g.[ [1,2], [2,3] ]
Syntex:
getWagstaffPrime(startLimit,endLimit)
Return Type:list
Syntex:
getWieferichPrime(startLimit,endLimit)
Return Type:list
Syntex:
getWilsonPrime(startLimit,endLimit)
Return Type:list
Syntex:
getLeftTruncatablePrime(startLimit,endLimit)
Return Type:list
Syntex:
getRightTruncatablePrime(startLimit,endLimit)
Return Type:list
Syntex:
getTruncatablePrime(startLimit,endLimit)
Return Type:list
Syntex:
getGaussianPrime(startLimit,endLimit)
Return Type:None
This Section is related to Number factorization. Use Semi-Prime where it is indicated.
Syntex:
getFactorTraditional(semiPrimeNumber)
Return Type:list
Note: This function will work all kind of number but I'll suggest to use Semi prime number because This funciton returns Factor of input number except 1 and number itself.
Syntex:
getFactorFermatTheorem(semiPrimeNumber)
Return Type:tuple
Note: This is only for composite number who have only two prime factors except number itself e.g. 33 have two prime factors 3 and 11.
Syntex:
getFactorPollardRho(semiPrimeNumber)
Return Type:integer
Note: This will return any one factor of given number because this algorithem works on random numbers.
Syntex:
getAllFactors(compositeNumber)
Return Type:list
Note: This will return list of all prime factors.
MIT
Free Software, Hell Yeah!
Follow me on