Skip to main content

A primer for prime numbers

Project description

Brute force functions for teaching purposes. Not performant.

To use as a package:

>>> import primer
>>> primer.primes(10)
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
>>> primer.prime(10)
29
>>> primer.primorial(10)
6469693230
>>> primer.sieve(40)
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
>>>

To use as a script:

$ python -m primer [-h] [-t] [N]

Display the first N primes.

positional arguments:

N Number of primes to generate (default: 100)

optional arguments:
-h, --help

show this help message and exit

-t

Display elapsed time (default: False)

Version 1.4.2 2015-04-01

  • Make installed tests runnable as script. (cbc)

Version 1.4.1 2015-04-01

  • Make reduce readable. HAFD. (cbc)

Version 1.4 2015-03-26

  • Single version for Python 2/3. (cbc)

Version 1.3 2015-03-25

  • Add sieve function. (cbc)

  • Rename test methods. (cbc)

Version 1.2.1 2015-03-25

  • Update README. (cbc)

Version 1.2 2015-03-25

  • Mark prime generator function private. (cbc)

  • Update docstrings. (cbc)

  • Fix test module name. (cbc)

  • Rename test data. (cbc)

Version 1.1.1 2015-03-25

  • Update README. (cbc)

Version 1.1 2015-03-25

  • Add primorial function. (cbc)

Version 1.0.2 2015-03-25

  • Fix keywords. (cbc)

Version 1.0.1 2015-03-25

  • Release testing. (cbc)

Version 1.0 2015-03-23

  • Initial release. (cbc)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

primer-1.4.2.zip (15.4 kB view details)

Uploaded Source

File details

Details for the file primer-1.4.2.zip.

File metadata

  • Download URL: primer-1.4.2.zip
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for primer-1.4.2.zip
Algorithm Hash digest
SHA256 6510d3ff3566f8fb1c227541eabd6e2afdea28f78b2c971956b62198c14918bd
MD5 049dcce87fd82c7802a76733e9dde119
BLAKE2b-256 50580d1f0110225bb5a83c9836ccde9b52a5cc345ab68e23ddda5d8b61bb60ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page