{ "info": { "author": "Jared Suttles", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: C++", "Programming Language :: Python", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "pyprimesieve\n============\n\nMany primes, very fast. Uses primesieve_.\n\nprimesieve, one of the fastest (if not the fastest) prime sieve implementaions available, is actively maintained by\nKim Walisch.\n\nIt uses a segmented sieve of Eratosthenes with wheel factorization for a complexity of ``O(nloglogn)`` operations.\n\n\nPerformance\n-----------\n\nRegarding primesieve for C++:\n\n primesieve generates the first 50,847,534 primes up to 10^9 in just 0.4 seconds on a single core of an Intel Core\n i7-920 2.66GHz, this is about 50 times faster than an ordinary C/C++ sieve of Eratosthenes implementation and about\n 10,000 times faster than trial-division. primesieve outperforms [Kim's] older ecprime_ (fastest from 2002 to 2010) by\n about 30 percent and also substantially outperforms primegen_ the fastest sieve of Atkin implementation on the\n web.\n\nFor comparison, on an Intel Core i7 2GHz, ``pyprimesieve`` populates an entire Python list of the first\n50,847,534 primes in 1.40 seconds. It's expected that a Python implementation would be slower than C++ but,\nsurprisingly, by only one second.\n\n``pyprimesieve`` outperforms all of the fastest prime sieving implementations for Python.\n\nTime (ms) to generate the all primes below one million and iterate over them in Python:\n\n=================== =============\n algorithm time\n------------------- -------------\npyprimesieve 2.79903411865\nprimesfrom2to 13.1568908691\nprimesfrom3to 13.5800838470\nambi_sieve 16.1600112915\nrwh_primes2 38.7749671936\nrwh_primes1 48.5658645630\nrwh_primes 52.0040988922\nsieve_wheel_30 59.3869686127\nsieveOfEratosthenes 59.4990253448\nambi_sieve_plain 161.740064621\nsieveOfAtkin 232.724905014\nsundaram3 251.194953918\n=================== =============\n\nIt can be seen here that ``pyprimesieve`` is *4.7 times faster* than the fastest Python alternative using ``Numpy`` and\n*13.85 times faster* than the fastest pure Python sieve.\n\nAll benchmark scripts and algorithms are available for reproduction. Prime sieve algorithm implementations were taken\nfrom `this discussion on SO`_.\n\nFunctions\n---------\n\n**primes(n)**: List of prime numbers up to `n`.\n\n**primes(start, n)**: List of prime numbers from `start` up to `n`.\n\n**primes_sum(n)**: The summation of prime numbers up to `n`. The optimal number of threads will be determined for the\ngiven number and system.\n\n**primes_sum(start, n)**: The summation of prime numbers from `start` up to `n`. The optimal number of threads will be\ndetermined for the given numbers and system.\n\n**primes_nth(n)**: The nth prime number.\n\n**factorize(n)**: List of tuples in the form of (prime, power) for the prime factorization of `n`.\n\n\nInstallation\n------------\n\n.. code-block:: bash\n\n pip install pyprimesieve\n\n**NOTE**: To enable the parallelized version of prime summation, you must use a compiler that supports OpenMP. You may\nneed to pass a valid compiler as an environment variable.\n\n\nTesting\n-------\n\nAfter installation, you can make sure everything is working by running the following inside the project root folder,\n\n.. code-block:: bash\n\n python tests\n\n\nLicense\n-------\n\n\"Modified BSD License\". See LICENSE for details. Copyright Jared Suttles, 2015.\n\n.. _primesieve: https://github.com/kimwalisch/primesieve\n.. _ecprime: http://primzahlen.de/referenten/Kim_Walisch/index2.htm\n.. _primegen: http://cr.yp.to/primegen.html\n.. _`this discussion on SO`: http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python\n\n\nChanges\n=======\n\n0.1.6 (2015-07-07)\n------------------\n\n- Python 3 support\n- No longer assume `g++` in `setup.py` but rather tries installing with OpenMP and retries if that fails\n\n\n0.1.5 (2015-07-05)\n------------------\n\n- added to pypi\n\n\n0.1.4 (2013-08-06)\n------------------\n\n- Parallel prime summation is now a class\n - Threads calling callback method are NOT synchronized so faster on large input\n - Updated README in bench to reflect new timings (small input is slightly worse but large is twice as fast)\n\n\n0.1.3 (2013-08-05)\n------------------\n\n- Fixed compilation warnings\n- extern \"C\"\n- Added more information regarding installation to README; updated docstring\n\n\n0.1.2 (2013-07-12)\n------------------\n\n- primes_nth uses callback class instead of creating any PyObjects in order to call primes\n - Caused a memory leak and was unnecessary\n\n\n0.1.1 (2013-07-12)\n------------------\n\n- Distutils setup.py: got multithreaded summation compiling with OpenMP\n - Removed all code to manually compile executable\n - CC and CXX environment variables set to avoid clang (and other non-openmp compilers) use\n- Replaced executable code with parallelized function in the actual extension\n- Rewrote primes_sum and primes_nth Python functions in C++ and removed Python script completely\n\n\n0.1.0 (2013-07-06)\n------------------\n\n- pyprimesieve initial", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jaredks/pyprimesieve", "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "pyprimesieve", "package_url": "https://pypi.org/project/pyprimesieve/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyprimesieve/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/jaredks/pyprimesieve" }, "release_url": "https://pypi.org/project/pyprimesieve/0.1.6/", "requires_dist": null, "requires_python": null, "summary": "Many primes, very fast. Uses primesieve.", "version": "0.1.6" }, "last_serial": 1623400, "releases": { "0.1.5": [ { "comment_text": "", "digests": { "md5": "d642679524932f22858a6d2f887b5e99", "sha256": "9831539ea8beb145c54434904efbd686e01c8ff21e1503c0f099217badfd1d89" }, "downloads": -1, "filename": "pyprimesieve-0.1.5.tar.gz", "has_sig": false, "md5_digest": "d642679524932f22858a6d2f887b5e99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32629, "upload_time": "2015-07-05T22:23:00", "url": "https://files.pythonhosted.org/packages/29/f1/7dbe32beaabcac77cfd4870d0fdf6bac9749f024055f86b30d92aae2d44c/pyprimesieve-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "b5117f70b4237b48a7b28f25e92bb8c1", "sha256": "a35ff1fe6453ba3c6e833dd1ac4719a23644e6130294159366eeaea96f1894a5" }, "downloads": -1, "filename": "pyprimesieve-0.1.6.tar.gz", "has_sig": false, "md5_digest": "b5117f70b4237b48a7b28f25e92bb8c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34537, "upload_time": "2015-07-07T22:18:55", "url": "https://files.pythonhosted.org/packages/71/65/df0f953cfda5aa6dba56bcbeac5707f544bf0ad5b649a6a7807c5e09966e/pyprimesieve-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b5117f70b4237b48a7b28f25e92bb8c1", "sha256": "a35ff1fe6453ba3c6e833dd1ac4719a23644e6130294159366eeaea96f1894a5" }, "downloads": -1, "filename": "pyprimesieve-0.1.6.tar.gz", "has_sig": false, "md5_digest": "b5117f70b4237b48a7b28f25e92bb8c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34537, "upload_time": "2015-07-07T22:18:55", "url": "https://files.pythonhosted.org/packages/71/65/df0f953cfda5aa6dba56bcbeac5707f544bf0ad5b649a6a7807c5e09966e/pyprimesieve-0.1.6.tar.gz" } ] }