Skip to main content

provides the most famous of 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.

Updates (0.0.8)

Minor bug fixes

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.8.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

sequences-0.0.8-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sequences-0.0.8.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for sequences-0.0.8.tar.gz
Algorithm Hash digest
SHA256 c972dced122c1b845b833e8e7dda99a8e44296402394d8b14da1dc2446a81671
MD5 56f5d42a0c35176ceb5ce06957a8d05f
BLAKE2b-256 81511624ea93996dba49a384ae9985f14e460c135cfeb8f3a5c217f03ffe2ebf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sequences-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for sequences-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0597a42444278a895c07794e0e407b6191822c13b07cc2d0aa38f7012976745c
MD5 036a5fb403c647c195f36c059a255568
BLAKE2b-256 ef4fb4d63843579c3d7fc25fcfd872d05f28509fdb94348c0eeac82158abb407

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