Skip to main content

provides many of the most famous sequences of the OEIS

Project description

sequences

This is a simple Mathematical Module which is easy to use. The module provides many of the most famous sequences from the On-Line Encyclopedia of International Sequences (OEIS) as Python Functions that return a list of the first 'n' terms of that sequence. Help text is included for each function so that the user gets an idea of what to expect as the output to each function.

Examples of Functions provided

  • whole(n)

    [0, 1, 2, 3, ..., n]

  • square(n)

    [0, 1, 4, 9, ..., pow(n, 2)]

  • prime(n)

    [2, 3, 5, 7, 11, ...]

  • composite(n)

    [4, 6, 8, 9, 10, ...]

  • fibonacci(n)

    [0, 1, 1, 2, 3, ..., sum([F(n-1), F(n-2)])]

  • tribonacci(n)

    [0, 1, 1, 2, 4, ..., sum([T(n-1), T(n-2), T(n-3)])]

  • pascal(n):

    [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], ...]
    the nth row of Pascal's triangle (as a List)
    P(n) = comb(n, r) for r in range(n+1)

  • look_say(n)

    [1, 11, 21, 1211, 111221, ...]
    T(n) = 0 if n == 0
    T(n) = int(word for T(n-1)) otherwise

  • recaman(n)

    [0, 1, 3, 6, 2, ...]
    T(n) = 0 if n == 0
    T(n) = T(n-1) - n if positive and not already in sequence
    T(n) = T(n-1) + n otherwise

  • van_eck(n)

    [0, 0, 1, 0, 2, ...]
    T(n) = 0 if n == 0
    T(n) = 0 if T(n-1) is a new number
    T(n) = x if T(n) occured x steps earlier in the sequence

And many more... Access the names of all the functions through dir() in python. Each function contains help text that can be accessed through help() in python to know more about it.

Updates (0.0.5)

Minor bug fixes

Updates (0.0.6)

Added new sequences like:

  • catalan(n)

    [1, 1, 2, 5, 14, ..., comb(2n, n) / (n+1)]

  • aronson(n)

    [1, 4, 11, 16, 24, ...]
    these numbers are obtained from the index of english letter "T" or "t" in the sentence: "T is the first, fourth, eleventh, sixteenth, ... letter in this sentence." ignoring spaces and punctuation marks

  • cantral_polygon(n)

    [1, 2, 4, 7, 11, ..., (pow(n, 2) + n+2) / 2]

Updates (0.0.7)

Added new sequences like:

  • lucas(n)

    [2, 1, 3, 4, 7, ..., sum([L(n-1) + L(n-2)])]

  • negalucas(n)

    [2, -1, 3, -4, 7, ..., pow(-1, n) * L(n)]

  • euclid_mullin(n)

    [2, 3, 7, 43, 13, ...]
    T(n) = 2 if n == 1
    T(n) = smallest prime factor of product(euclid_mullin(n)) + 1 otherwise

  • prime_powers(n)

    [2, 3, 4, 5, 7, ...]
    these numbers are of the form pow(x, n) where x is a prime and n is a positive integer

  • central_binomial(n)

    [1, 2, 6, 20, 70, ..., comb(2n, n)]

  • semiprime(n)

    [4, 6, 9, 10, 14, ...]
    these numbers are the product of two primes not necessarily distinct

And many more... Access the names of all the functions through dir() in python.

Reach out to me

If you face issues, contact me through my e-mail: knightt1821@gmail.com

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

sequences-0.0.7.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

sequences-0.0.7-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file sequences-0.0.7.tar.gz.

File metadata

  • Download URL: sequences-0.0.7.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for sequences-0.0.7.tar.gz
Algorithm Hash digest
SHA256 4a6e6ada34757528ba46025ec184bb973ddda10cf424792d9fbc80cc53c11b91
MD5 28b4ff4f17247f89945ae352f25f04a8
BLAKE2b-256 23dda2ab9adafbf305a7ad29a5921d39dbeff176ff2135e3ac097a9f22b55444

See more details on using hashes here.

File details

Details for the file sequences-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: sequences-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for sequences-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3fe960e919d27cb36b5bbfd0bf6b41c27c9e5035566ff81d20b199e14bb7c0ea
MD5 49ee4e38359b4bfbeafa0f613a2874d2
BLAKE2b-256 0bf7a42002b9cd9d48c3f1be968a80e3b5ef56a255c172482706718f1d4cbbc4

See more details on using hashes here.

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