{ "info": { "author": "sylhare", "author_email": "sylhare@outlook.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "nprime\n======\n\n|Generic badge| |PyPI version| |Build Status| |codecov| |Codacy Badge|\n\nInstallation\n------------\n\nTo install the package use pip:\n\n::\n\n pip install nprime\n\nIntroduction\n------------\n\nSome algorithm on prime numbers. You can find all the functions in the\nfile ``nprime/pryprime.py``\n\nAlgorithm developed :\n\n- Eratosthenes sieve based\n- Fermat's test (based on Fermat's theorem)\n- Prime generating functions\n- Miller Rabin predictive algorithm\n\nSpecifications\n--------------\n\n- Language: Python **3.5.2**\n- Package:\n\n - Basic python packages were preferred\n - Matplotlib v2.0 - graph and math\n\nIntegration and pipeline\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nCode quality is monitored through\n`codacity `__. For\nthe tests coverage, there's\n`codecov `__ which is run during\nthe `Travis CI `__ pipeline.\n\nMath\n----\n\nHere are a bit of information to help understand some of the algorithms\n\nCongruence\n~~~~~~~~~~\n\n\"``\u2261``\" means congruent, ``a \u2261 b (mod m)`` implies that\n``m / (a-b), \u2203 k \u2208 Z`` that verifies ``a = kn + b``\n\nwhich implies:\n\n::\n\n a \u2261 0 (mod n) <-> a = kn <-> \"a\" is divisible by \"n\" \n\nStrong Pseudoprime\n~~~~~~~~~~~~~~~~~~\n\nA strong\n`pseudoprime `__ to\na base ``a`` is an odd composite number ``n`` with ``n-1 = d\u00b72^s`` (for\nd odd) for which either ``a^d = 1(mod n)`` or ``a^(d\u00b72^r) = -1(mod n)``\nfor some ``r = 0, 1, ..., s-1``\n\nErathostene's Sieve\n~~~~~~~~~~~~~~~~~~~\n\nHow to use\n^^^^^^^^^^\n\nImplementation of the sieve of erathostenes that discover the primes and\ntheir composite up to a limit. It returns a dictionary: - the key are\nthe primes up to n - the value is the list of composites of these primes\nup to n\n\n.. code:: python\n\n from nprime.pyprime import sieve_eratosthenes\n\n # With as a parameter the upper limit\n sieve_eratosthenes(10)\n >> {2: [4, 6, 8], 3: [6, 9], 5: [], 7: []}\n\nTheory\n^^^^^^\n\nThis sieve mark as composite the multiple of each primes. It is an\nefficient way to find primes. For ``n \u2208 N`` with ``n > 2`` and for\n``\u2200 a \u2208[2, ..., \u221an]`` then ``n/a \u2209 N`` is true.\n\n|Erathostene example|\n\nFermat's Theorem\n~~~~~~~~~~~~~~~~\n\nHow to use\n^^^^^^^^^^\n\nA Probabilistic algorithm taking ``t`` randoms numbers ``a`` and testing\nthe Fermat's theorem on number ``n > 1`` Prime probability is right is\n``1 - 1/(2^t)`` Returns a boolean: True if ``n`` passes the tests.\n\n.. code:: python\n\n from nprime.pyprime import fermat\n\n # With n the number you want to test\n fermat(n)\n\nTheory\n^^^^^^\n\nIf ``n`` is prime then ``\u2200 a \u2208[1, ..., n-1]``\n\n::\n\n a^(n-1) \u2261 1 (mod n) \u21d4 a^(n-1) = kn + 1\n\nMiller rabin\n~~~~~~~~~~~~\n\nHow to use\n^^^^^^^^^^\n\nA probabilistic algorithm which determines whether a given number (n >\n1) is prime or not. The miller\\_rabin tests is repeated ``t`` times to\nget more accurate results. Returns a boolean: True if ``n`` passes the\ntests.\n\n.. code:: python\n\n from nprime.pyprime import miller_rabin\n\n # With n the number you want to test\n miller_rabin(n)\n\nTheory\n^^^^^^\n\nFor ``n \u2208 N`` and ``n > 2``, Take a random ``a \u2208 {1,...,n\u22121}`` Find\n``d`` and ``s`` such as with ``n - 1 = 2^s * d`` (with d odd) if\n``(a^d)^2^r \u2261 1 mod n`` for all ``r`` in ``0`` to ``s-1`` Then ``n`` is\nprime.\n\nThe test output is false of 1/4 of the \"a values\" possible in ``n``, so\nthe test is repeated t times.\n\n.. |Generic badge| image:: https://img.shields.io/badge/github-nprime-blue.svg\n :target: https://github.com/sylhare/nprime\n.. |PyPI version| image:: https://badge.fury.io/py/nprime.svg\n :target: https://badge.fury.io/py/nprime\n.. |Build Status| image:: https://travis-ci.org/sylhare/nprime.svg?branch=master\n :target: https://travis-ci.org/sylhare/nprime\n.. |codecov| image:: https://codecov.io/gh/sylhare/nprime/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/sylhare/nprime\n.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/3f1889b9069645faa6ec38cb4b117b1d\n :target: https://www.codacy.com/app/sylhare/nprime?utm_source=github.com&utm_medium=referral&utm_content=sylhare/nprime&utm_campaign=Badge_Grade\n.. |Erathostene example| image:: https://upload.wikimedia.org/wikipedia/commons/b/b9/Sieve_of_Eratosthenes_animation.gif\n :target: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Sylhare/nprime", "keywords": "prime,fermat,miller rabin,math", "license": "GNU General Public License v3.0", "maintainer": "", "maintainer_email": "", "name": "nprime", "package_url": "https://pypi.org/project/nprime/", "platform": "any", "project_url": "https://pypi.org/project/nprime/", "project_urls": { "Homepage": "https://github.com/Sylhare/nprime" }, "release_url": "https://pypi.org/project/nprime/1.0.0/", "requires_dist": [ "matplotlib (>=2.1)" ], "requires_python": "", "summary": "Python library for primes algorithms", "version": "1.0.0" }, "last_serial": 4751698, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "0aa89701322349dfbebc2106d0b1045b", "sha256": "9423722925033c6466bf27f636951a4999121c3c060202d95413b124310a0feb" }, "downloads": -1, "filename": "nprime-0.0.1.tar.gz", "has_sig": false, "md5_digest": "0aa89701322349dfbebc2106d0b1045b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12531, "upload_time": "2018-01-28T15:40:56", "url": "https://files.pythonhosted.org/packages/68/c4/78200d38c6d9e85c347d9449d14c005a66044114531af4118528472a93d5/nprime-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "86fdbe2ae8f348b70ecbd2a229da9ff4", "sha256": "c7287e5ae26ae5d19f1192593fce257dd70ceee14bcbb4a088b8401506c845b0" }, "downloads": -1, "filename": "nprime-0.0.2.tar.gz", "has_sig": false, "md5_digest": "86fdbe2ae8f348b70ecbd2a229da9ff4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11913, "upload_time": "2018-01-30T14:06:11", "url": "https://files.pythonhosted.org/packages/3d/2d/32129bc76fe944bb892be75971c4e5f1a7c8b3b244cd4f137ee10fb48161/nprime-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "818b830fd7994bc1efbae97cf5563ffd", "sha256": "3c907d001e1ee95b441704e4c4f11c273b450d387c3b797d16c907d79bde2fa9" }, "downloads": -1, "filename": "nprime-0.0.3.tar.gz", "has_sig": false, "md5_digest": "818b830fd7994bc1efbae97cf5563ffd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11397, "upload_time": "2018-01-30T14:34:38", "url": "https://files.pythonhosted.org/packages/39/a3/9381da7ac6311a928222c4c029152ca6a8ad4eeda61a9623f3c1376b65ea/nprime-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "9cf31ec9934c4cdeb69b9ba0f29419e2", "sha256": "d70d036463d4f1a42c950dafbb597ba9500a1f68c9476637404c0957463181e5" }, "downloads": -1, "filename": "nprime-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9cf31ec9934c4cdeb69b9ba0f29419e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11756, "upload_time": "2018-01-30T16:35:50", "url": "https://files.pythonhosted.org/packages/1d/d1/b4b0fe4c0c565382f8014ac56b8f4b414b0792d207400ce7585f3f77c364/nprime-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "dbca6aeade36b291aad9925a6ac425b0", "sha256": "0aeb9d067120e6e0a36b2e6605d862b8767ab116b85a90801f5452798afd041a" }, "downloads": -1, "filename": "nprime-0.0.5.tar.gz", "has_sig": false, "md5_digest": "dbca6aeade36b291aad9925a6ac425b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11752, "upload_time": "2018-01-30T16:45:16", "url": "https://files.pythonhosted.org/packages/4b/d7/7d5e5acde69197bd2448c8ae8740b332a401b2dcf16d4ceb8be7cb266e91/nprime-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "6c4684285548dcba480010ca7636ce96", "sha256": "9d6745113a56f145bd5c25afd417fb62370ea10f812c982b9a9183d229219c37" }, "downloads": -1, "filename": "nprime-0.0.6.tar.gz", "has_sig": false, "md5_digest": "6c4684285548dcba480010ca7636ce96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11749, "upload_time": "2018-01-30T18:43:34", "url": "https://files.pythonhosted.org/packages/78/8c/a0c71fdacb20828f8de0a6e1b15b95d6f088752b41994f7ab2cc22627f3b/nprime-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "61a682cf2eb071f630d52e74395ba387", "sha256": "a73e95d2c76de5d5d9ce8ed77fa82d75c2ef2e9412688a36e5da658b5d05dc38" }, "downloads": -1, "filename": "nprime-0.0.7.tar.gz", "has_sig": false, "md5_digest": "61a682cf2eb071f630d52e74395ba387", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11848, "upload_time": "2018-01-31T14:28:07", "url": "https://files.pythonhosted.org/packages/0e/4d/d4a51283b03ab3864c07b7f16972c057bb9c6847e6f177096849e80ef4e7/nprime-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "de9a03dcb40befc9ab92b4ec5818a5d2", "sha256": "cefff73d36d735657f5aac4271247a47e4240a0ce5c1e66827d56f2c559701eb" }, "downloads": -1, "filename": "nprime-0.0.8.tar.gz", "has_sig": false, "md5_digest": "de9a03dcb40befc9ab92b4ec5818a5d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25394, "upload_time": "2018-01-31T14:30:35", "url": "https://files.pythonhosted.org/packages/26/83/ffef0a9eb5008a0508b21acde82a6597b3b19f1f9c50fd251e7372d98de8/nprime-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "99b02cf9ab0d349df85fca056de45c96", "sha256": "53c8e6391185b01d7720f8c38f9c9059f5f75b116672fd4d249ad72cc3703879" }, "downloads": -1, "filename": "nprime-0.0.9.tar.gz", "has_sig": false, "md5_digest": "99b02cf9ab0d349df85fca056de45c96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25408, "upload_time": "2018-01-31T16:02:51", "url": "https://files.pythonhosted.org/packages/f8/02/980b82d73e65c454c5acdd01323baafc49e2d1975048486777e4b510686f/nprime-0.0.9.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "e3002bb54c5b3f617076cb01ebc48f29", "sha256": "610b503560ae9edf14261b01c877a8531a5166f94629b9ff4de94c22d8765e84" }, "downloads": -1, "filename": "nprime-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e3002bb54c5b3f617076cb01ebc48f29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25546, "upload_time": "2018-02-01T14:00:47", "url": "https://files.pythonhosted.org/packages/d6/9d/a8b19b76c38d7acd855bb005022d50fca667d022f4495ad2527fa8ca3443/nprime-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3b333e91dcb07140ab97c4a796a7ffe5", "sha256": "739c364c93f88aeff09e0f71eba013268d64721ade6f91ffae444e51fa5c3a3e" }, "downloads": -1, "filename": "nprime-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3b333e91dcb07140ab97c4a796a7ffe5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25659, "upload_time": "2018-02-01T14:43:40", "url": "https://files.pythonhosted.org/packages/67/15/fb33c0b3ef357deb38328cc119d0b5f389c34f80d58dae3fb92408de4a81/nprime-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b01901ac6cd99116ce6ef67db5465b8e", "sha256": "8594e38ab7c071c04d94caa2c38d4dca84929f50cc511d8393aa523bc131032a" }, "downloads": -1, "filename": "nprime-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b01901ac6cd99116ce6ef67db5465b8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25658, "upload_time": "2018-02-01T15:47:52", "url": "https://files.pythonhosted.org/packages/f4/17/57e9c3935a177fb74aee03ea8e62088b3b01adbb0f4fddc4d2fc143d1fcd/nprime-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "44a26cd44d826f6d7a861360b044017b", "sha256": "552bc467fc3e4bb369c96fd3df70a11fc927119fdc66fe806ab47e5f642990a5" }, "downloads": -1, "filename": "nprime-0.1.3.tar.gz", "has_sig": false, "md5_digest": "44a26cd44d826f6d7a861360b044017b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21985, "upload_time": "2018-02-03T17:01:40", "url": "https://files.pythonhosted.org/packages/aa/fb/f689b9bbc63f34756e1da76d45769457b2ecdaf470fce2ef01cd735905ad/nprime-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "b48b227bf4a2a847666311c00a0c11e2", "sha256": "72a0dfcfaab275f06f89e7052c759e84dbb919cd97b749d14492107fb0529a38" }, "downloads": -1, "filename": "nprime-0.1.4.tar.gz", "has_sig": false, "md5_digest": "b48b227bf4a2a847666311c00a0c11e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22113, "upload_time": "2018-02-04T00:54:18", "url": "https://files.pythonhosted.org/packages/b9/76/47a25e821ef54dd90da618bacb47eb0458f203a598b8e330374537d26e9e/nprime-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "767c0048901ca747a6fc2a0b1c5f7754", "sha256": "5e6852b547d0be1ca8e9d69e84104db13d2746932455e9f99d398f62a55221a3" }, "downloads": -1, "filename": "nprime-0.1.5.tar.gz", "has_sig": false, "md5_digest": "767c0048901ca747a6fc2a0b1c5f7754", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20917, "upload_time": "2018-02-04T13:47:31", "url": "https://files.pythonhosted.org/packages/e5/38/3c6cc7960bec0718a109718e3d5f45c847cdb6ca7a0266817d87721d34ed/nprime-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "2c99a733843ff9eb931a5d75639af016", "sha256": "8dcb2bf6dce58d7a7d4ba14e94ccf5fc1452a409602e3ff3360c66515838ebe3" }, "downloads": -1, "filename": "nprime-0.1.6.tar.gz", "has_sig": false, "md5_digest": "2c99a733843ff9eb931a5d75639af016", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22604, "upload_time": "2018-02-04T15:24:39", "url": "https://files.pythonhosted.org/packages/c8/b5/4aebe4f669015d58eca86e75ca1f33a4eadf311dd9e9704891b02264055b/nprime-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "a07369e6f159d6342075e5bf1b582c50", "sha256": "e5ce2a5f8b25e876fd5932a146b2f1a24b4c217a9c8da7d221a1139360b402cb" }, "downloads": -1, "filename": "nprime-0.1.7.tar.gz", "has_sig": false, "md5_digest": "a07369e6f159d6342075e5bf1b582c50", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23127, "upload_time": "2018-02-04T15:51:11", "url": "https://files.pythonhosted.org/packages/0e/ae/afdec017ddd1c5b88fd21b2ecc541302980f9bc36b267fcb809c0b732216/nprime-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "cdd35fb18bd1ff9a07b820933f12c053", "sha256": "21c788c656df44fe3c0f5b157f7d96ec865a5bf7f3d1b15ad05d1fcbd13377f3" }, "downloads": -1, "filename": "nprime-0.1.8.tar.gz", "has_sig": false, "md5_digest": "cdd35fb18bd1ff9a07b820933f12c053", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23190, "upload_time": "2018-03-13T18:58:34", "url": "https://files.pythonhosted.org/packages/32/9b/553cdf9c27167ba6e91a7d2a546f456f6b8d56891b173503f4e792feeaa7/nprime-0.1.8.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "3d93801c0ca4717860ee7a75a65f3c74", "sha256": "ebe304585b6d84c6b316791969d41ad1f55859bfa86e3041b8a9cb64affdc1ed" }, "downloads": -1, "filename": "nprime-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3d93801c0ca4717860ee7a75a65f3c74", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 30345, "upload_time": "2019-01-28T20:14:07", "url": "https://files.pythonhosted.org/packages/7a/92/34305240ef3fb1a0af4b4bce25e67c05af71e9bf537de824393a8a91447f/nprime-1.0.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3d93801c0ca4717860ee7a75a65f3c74", "sha256": "ebe304585b6d84c6b316791969d41ad1f55859bfa86e3041b8a9cb64affdc1ed" }, "downloads": -1, "filename": "nprime-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3d93801c0ca4717860ee7a75a65f3c74", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 30345, "upload_time": "2019-01-28T20:14:07", "url": "https://files.pythonhosted.org/packages/7a/92/34305240ef3fb1a0af4b4bce25e67c05af71e9bf537de824393a8a91447f/nprime-1.0.0-py3-none-any.whl" } ] }