Skip to main content

Truncatable prime number generators

Project description

Truncatable primes

A Python library that generates that generates sequences of truncatable prime numbers and derivatives of the sequences in the form of a package that can be installed and imported.

A truncatable prime is still prime when number is truncated. For example, 317 is a left truncatable prime because 17 and 7 are prime. It is also a right truncatable prime because 31 and 3 are prime.

The intention of this library is to provide code that is reasonably efficient and readable. It is not difficult to track down cryptic one-liner code that produces identical results.

Getting Started

Python 3 is assumed.

Installing

Using the source code from github

git clone https://github.com/harry-zuzan/trprimes.git
cd trprimes
python setup.py install

Using pip

pip install trprimes

Examples

from trprimes import trunc

# the number of left truncatable primes
trunc.count_ltrunc()

# the largest of left truncatable prime
trunc.largest_ltrunc()

# iterate through left truncatable primes in ascending order
ltp = trunc.ordered_ltrunc()
next(ltp)

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

trprimes-0.1.1.tar.gz (60.9 kB view hashes)

Uploaded Source

Built Distribution

trprimes-0.1.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

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