primelibpy


Nameprimelibpy JSON
Version 2.2 PyPI version JSON
download
home_pagehttps://github.com/mit1280/primelibpy
SummaryThis library can be used in cryptoanalysis and some compatitive exams. It cover many different types of prime number and three factorization algorithems. This library also helps to generate random spacific type of prime number with desire digits. To use this library you mast have python 3.x
upload_time2022-12-29 15:36:19
maintainer
docs_urlNone
authorMIT
requires_python>=3.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Python Prime Library
====================

This is the official documentation of the python prime library.

-  Generate Specific types of Prime numbers between the given range
-  Generate Random Prime number 
-  Factorization of the given number


===============

Installation!
=============

Use pip3 if you are using python version 3+ else follow the same steps as mentioned below:

1. If you don’t have pip then follow the below procedure else go to step 2.

-  For window Users

   -  Download `get-pip <https://bootstrap.pypa.io/get-pip.py>`__ 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``

-  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-setuptools 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-setuptools python3-wheel``

-  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``

2. Import gmpy2 file

   -  This package is required to install primelibpy library
   -  Run the following command 

      ``$ pip install gmpy2==2.1.0a2``

3. Now, install the prime python library using the below command.

   -  Run the following command 

      ``$ pip install primelibpy``

4. How to use Library

   -  Inside of your python IDE(Python file)

      ``from primelibpy import Prime as p``

   -  Now, using ``p`` all functions can be used in code
      e.g.

      ``balancedNumberList = p.getBalancedPrime(2,100,2)``


^^^^^^^^^^^^^^^^^^^^^

Functions Description
=====================

-  .. rubric:: Prime Functions
      :name: prime-functions

   In all the prime numbers Start_Limit and End_Limit are the range of prime numbers the user wants to print inclusively.

Balanced Prime
^^^^^^^^^^^^^^

   Syntex:  ``getBalancedPrime(startLimit,endLimit,balancedMode)``

   Return Type: ``list`` 

   **Description:** Balanced_Mode is how number which
   decide a balanced limit for prime.

Circular Prime
^^^^^^^^^^^^^^

   Syntex: ``getCircularPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Cousin Prime
^^^^^^^^^^^^

   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] ]

Double Mersenne Prime
^^^^^^^^^^^^^^^^^^^^^

   Syntex: ``getDoubleMersennePrime(startLimit,endLimit)``
 
   Return Type:  ``list``

Factorial Prime
^^^^^^^^^^^^^^^

   Syntex: ``getFactorialPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Good Prime
^^^^^^^^^^

   Syntex: ``getGoodPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Mersenne Prime
^^^^^^^^^^^^^^

   Syntex: ``getMersennePrime(startLimit,endLimit)`` 

   Return Type:  ``list``

Palindromic Prime
^^^^^^^^^^^^^^^^^

   Syntex: ``getPalindromicPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Permutable Prime
^^^^^^^^^^^^^^^^

   Syntex: ``getPermutablePrime(startLimit,endLimit)`` 

   Return Type: ``list``

Primorial Prime
^^^^^^^^^^^^^^^

   Syntex: ``getPrimorialPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Fermat Pseudo Prime
^^^^^^^^^^^^^^^^^^^

   Syntex: ``getFermatPseudoPrime(startLimit,endLimit,baseNumber)`` 

   Return Type: ``list`` 

   **Description:** Base_number helps to generate a composite
   the number and the second argument is the Total number of Pseudo primes

Pythagorean Prime
^^^^^^^^^^^^^^^^^

   Syntex: ``getPythagoreanPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Reversible Prime
^^^^^^^^^^^^^^^^

   Syntex: ``getReversiblePrime(startLimit,endLimit)`` 

   Return Type: ``list``

Semi Prime
^^^^^^^^^^

   Syntex: ``getSemiPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Sophie Germain Prime
^^^^^^^^^^^^^^^^^^^^

   Syntex: ``getSophieGermainPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Twin Prime
^^^^^^^^^^

   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] ]

Wagstaff Prime
^^^^^^^^^^^^^^

   Syntex: ``getWagstaffPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Wieferich Prime
^^^^^^^^^^^^^^^

   Syntex: ``getWieferichPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Wilson Prime
^^^^^^^^^^^^

   Syntex: ``getWilsonPrime(startLimit,endLimit)`` 

   Return Type: ``list``

Left Truncatable Prime
^^^^^^^^^^^^^^^^^^^^^^

   Syntex: ``getLeftTruncatablePrime(startLimit,endLimit)`` 

   Return Type:  ``list``

Right Truncatable Prime
^^^^^^^^^^^^^^^^^^^^^^^

   Syntex: ``getRightTruncatablePrime(startLimit,endLimit)``
 
   Return Type: ``list``

Truncatable Prime
^^^^^^^^^^^^^^^^^

   Syntex: ``getTruncatablePrime(startLimit,endLimit)`` 

   Return Type: ``list``

Gaussian Prime
^^^^^^^^^^^^^^

   Syntex:     ``checkGaussianPrime(realPart,imaginaryPart)`` 

   Return Type:    ``None``

   **Note:** ``This will print whether the number is gaussian or not``

=======================

Random Prime Generation
=======================

Random Prime generation function has three arguments and it requires little knowledge of above all functions. 

The first argument is the type of prime number. Note that **name of prime** followed by **Prime**. The name of the prime type has to be in the capital.

e.g. ``PrimorialPrime``


The second argument is the number of digits of random numbers. 

The third argument is only mandatory for balanced prime numbers.

   Syntex: ``getRandomPrime(primeType,totalDigits,mode=0)``

   Return Type: ``integer``


Example:

    ``import Prime as p``

    ``randomPrimorial = p.getRandomPrime("PrimorialPrime",3)``


===============

Factorization
=============
      
This Section is related to Number factorization. Use Semi-Prime where it is indicated.

Traditional Way for Factorization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Syntex:   ``getFactorTraditional(semiPrimeNumber)`` 

   Return Type:   ``list``

   **Note**: This function will work all kinds of numbers but I'll suggest using Semi prime number because This function returns the Factor of input number except 1 and the number itself.

Fermat Theorem for Factorization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Syntex:   ``getFactorFermatTheorem(semiPrimeNumber)`` 

   Return Type:   ``tuple`` 

   **Note**: This is only for composite numbers that have only two
   prime factors except for the number itself e.g. 33 have two prime factors 3
   and 11.

Pollard Rho Factorization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Syntex: ``getFactorPollardRho(semiPrimeNumber)`` 

   Return Type: ``integer`` 

   **Note:** This will return any one factor of the given number
   because this algorithm works on random numbers.

General Factorization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Syntex: ``getAllFactors(compositeNumber)`` 

   Return Type: ``list`` 

   **Note:** This will return a list of all prime factors.

License
-------

MIT

**Free Software, Hell Yeah!**

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mit1280/primelibpy",
    "name": "primelibpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "MIT",
    "author_email": "mitbpatel0128@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/75/21/e053ebbf2e01c8a82620b57fa31cefe0e2bb5caa1c21a9d1555ffb9aeec9/primelibpy-2.2.tar.gz",
    "platform": null,
    "description": "Python Prime Library\n====================\n\nThis is the official documentation of the python prime library.\n\n-  Generate Specific types of Prime numbers between the given range\n-  Generate Random Prime number \n-  Factorization of the given number\n\n\n===============\n\nInstallation!\n=============\n\nUse pip3 if you are using python version 3+ else follow the same steps as mentioned below:\n\n1. If you don\u2019t have pip then follow the below procedure else go to step 2.\n\n-  For window Users\n\n   -  Download `get-pip <https://bootstrap.pypa.io/get-pip.py>`__ to a\n      folder on your computer.\n   -  Put that file on Desktop\n   -  Open cmd and run the following commands:\n   \n    ``$ cd Desktop``\n\n    ``$ python get-pip.py``\n\n-  For Mac Users\n\n   -  Install python \n   \n     ``$ brew install python``\n     \n   -  Run the following command: \n      \n     ``$ python get-pip.py``\n\n-  For Linux Users\n\n   -  Run the following commands for python(version > 2.0):\n\n      ``$ sudo apt-get install python-pip``\n   \n      ``$ sudo pacman -S python2-pip``  \n\n      ``$ sudo yum upgrade python-setuptools``\n  \n      ``$ sudo yum install python-pip python-wheel``  \n\n      ``$ sudo dnf upgrade python-setuptools``\n   \n      ``$ sudo dnf install python-pip python-wheel``\n   \n      ``$ sudo zypper install python-pip python-setuptools python-wheel``\n\n   -  Run the following commands for python(version > 3.0):\n\n      ``$ sudo apt-get install python3-pip``\n  \n      ``$ sudo pacman -S python-pip``\n  \n      ``$ sudo yum install python3 python3-wheel``\n  \n      ``$ sudo dnf install python3 python3-wheel``\n   \n      ``$ sudo zypper install python3-pip python3-setuptools python3-wheel``\n\n-  For Raspberry Users\n\n   -  Run the following commands for python(version > 2.0):\n\n      ``$ sudo apt-get install python-pip``\n\n   -  Run the following commands for python(version > 2.0):\n\n      ``$ sudo apt-get install python3-pip``\n\n2. Import gmpy2 file\n\n   -  This package is required to install primelibpy library\n   -  Run the following command \n\n      ``$ pip install gmpy2==2.1.0a2``\n\n3. Now, install the prime python library using the below command.\n\n   -  Run the following command \n\n      ``$ pip install primelibpy``\n\n4. How to use Library\n\n   -  Inside of your python IDE(Python file)\n\n      ``from primelibpy import Prime as p``\n\n   -  Now, using ``p`` all functions can be used in code\n      e.g.\n\n      ``balancedNumberList = p.getBalancedPrime(2,100,2)``\n\n\n^^^^^^^^^^^^^^^^^^^^^\n\nFunctions Description\n=====================\n\n-  .. rubric:: Prime Functions\n      :name: prime-functions\n\n   In all the prime numbers Start_Limit and End_Limit are the range of prime numbers the user wants to print inclusively.\n\nBalanced Prime\n^^^^^^^^^^^^^^\n\n   Syntex:  ``getBalancedPrime(startLimit,endLimit,balancedMode)``\n\n   Return Type: ``list`` \n\n   **Description:** Balanced_Mode is how number which\n   decide a balanced limit for prime.\n\nCircular Prime\n^^^^^^^^^^^^^^\n\n   Syntex: ``getCircularPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nCousin Prime\n^^^^^^^^^^^^\n\n   Syntex:  ``getCousinPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\n   **Description**: Cousin prime are in pair so return list is have list\n   inside it e.g.[ [1,2], [2,3] ]\n\nDouble Mersenne Prime\n^^^^^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getDoubleMersennePrime(startLimit,endLimit)``\n \n   Return Type:  ``list``\n\nFactorial Prime\n^^^^^^^^^^^^^^^\n\n   Syntex: ``getFactorialPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nGood Prime\n^^^^^^^^^^\n\n   Syntex: ``getGoodPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nMersenne Prime\n^^^^^^^^^^^^^^\n\n   Syntex: ``getMersennePrime(startLimit,endLimit)`` \n\n   Return Type:  ``list``\n\nPalindromic Prime\n^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getPalindromicPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nPermutable Prime\n^^^^^^^^^^^^^^^^\n\n   Syntex: ``getPermutablePrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nPrimorial Prime\n^^^^^^^^^^^^^^^\n\n   Syntex: ``getPrimorialPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nFermat Pseudo Prime\n^^^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getFermatPseudoPrime(startLimit,endLimit,baseNumber)`` \n\n   Return Type: ``list`` \n\n   **Description:** Base_number helps to generate a composite\n   the number and the second argument is the Total number of Pseudo primes\n\nPythagorean Prime\n^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getPythagoreanPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nReversible Prime\n^^^^^^^^^^^^^^^^\n\n   Syntex: ``getReversiblePrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nSemi Prime\n^^^^^^^^^^\n\n   Syntex: ``getSemiPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nSophie Germain Prime\n^^^^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getSophieGermainPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nTwin Prime\n^^^^^^^^^^\n\n   Syntex: ``getTwinPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\n   **Description:** Twin prime are in pair so return list is have list\n   inside it e.g.[ [1,2], [2,3] ]\n\nWagstaff Prime\n^^^^^^^^^^^^^^\n\n   Syntex: ``getWagstaffPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nWieferich Prime\n^^^^^^^^^^^^^^^\n\n   Syntex: ``getWieferichPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nWilson Prime\n^^^^^^^^^^^^\n\n   Syntex: ``getWilsonPrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nLeft Truncatable Prime\n^^^^^^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getLeftTruncatablePrime(startLimit,endLimit)`` \n\n   Return Type:  ``list``\n\nRight Truncatable Prime\n^^^^^^^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getRightTruncatablePrime(startLimit,endLimit)``\n \n   Return Type: ``list``\n\nTruncatable Prime\n^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getTruncatablePrime(startLimit,endLimit)`` \n\n   Return Type: ``list``\n\nGaussian Prime\n^^^^^^^^^^^^^^\n\n   Syntex:     ``checkGaussianPrime(realPart,imaginaryPart)`` \n\n   Return Type:    ``None``\n\n   **Note:** ``This will print whether the number is gaussian or not``\n\n=======================\n\nRandom Prime Generation\n=======================\n\nRandom Prime generation function has three arguments and it requires little knowledge of above all functions. \n\nThe first argument is the type of prime number. Note that **name of prime** followed by **Prime**. The name of the prime type has to be in the capital.\n\ne.g. ``PrimorialPrime``\n\n\nThe second argument is the number of digits of random numbers. \n\nThe third argument is only mandatory for balanced prime numbers.\n\n   Syntex: ``getRandomPrime(primeType,totalDigits,mode=0)``\n\n   Return Type: ``integer``\n\n\nExample:\n\n    ``import Prime as p``\n\n    ``randomPrimorial = p.getRandomPrime(\"PrimorialPrime\",3)``\n\n\n===============\n\nFactorization\n=============\n      \nThis Section is related to Number factorization. Use Semi-Prime where it is indicated.\n\nTraditional Way for Factorization\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n   Syntex:   ``getFactorTraditional(semiPrimeNumber)`` \n\n   Return Type:   ``list``\n\n   **Note**: This function will work all kinds of numbers but I'll suggest using Semi prime number because This function returns the Factor of input number except 1 and the number itself.\n\nFermat Theorem for Factorization\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n   Syntex:   ``getFactorFermatTheorem(semiPrimeNumber)`` \n\n   Return Type:   ``tuple`` \n\n   **Note**: This is only for composite numbers that have only two\n   prime factors except for the number itself e.g. 33 have two prime factors 3\n   and 11.\n\nPollard Rho Factorization\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getFactorPollardRho(semiPrimeNumber)`` \n\n   Return Type: ``integer`` \n\n   **Note:** This will return any one factor of the given number\n   because this algorithm works on random numbers.\n\nGeneral Factorization\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n   Syntex: ``getAllFactors(compositeNumber)`` \n\n   Return Type: ``list`` \n\n   **Note:** This will return a list of all prime factors.\n\nLicense\n-------\n\nMIT\n\n**Free Software, Hell Yeah!**\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "This library can be used in cryptoanalysis and some compatitive exams. It cover many different types of prime number and three factorization algorithems. This library also helps to generate random spacific type of prime number with desire digits. To use this library you mast have python 3.x",
    "version": "2.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "7d9ed74a04dc95ba09cc244777e00537",
                "sha256": "5fc4bf30ee40c33e6cd64a7c045090c74953d8f73b838d60bf48aaeea9263024"
            },
            "downloads": -1,
            "filename": "primelibpy-2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7d9ed74a04dc95ba09cc244777e00537",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 9517,
            "upload_time": "2022-12-29T15:36:19",
            "upload_time_iso_8601": "2022-12-29T15:36:19.200856Z",
            "url": "https://files.pythonhosted.org/packages/75/21/e053ebbf2e01c8a82620b57fa31cefe0e2bb5caa1c21a9d1555ffb9aeec9/primelibpy-2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-29 15:36:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mit1280",
    "github_project": "primelibpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "primelibpy"
}
        
MIT
Elapsed time: 0.02453s