Skip to main content

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

Release files for sequences 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sequences 0.0.8
File Size Uploaded
sequences-0.0.8.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sequences 0.0.8
File Interpreter ABI Platform
sequences-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / sequences-0.0.8.tar.gz

Download URL sequences-0.0.8.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c972dced122c1b845b833e8e7dda99a8e44296402394d8b14da1dc2446a81671
BLAKE2b-256 checksum
How to use checksums
81511624ea93996dba49a384ae9985f14e460c135cfeb8f3a5c217f03ffe2ebf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Release files / sequences-0.0.8-py3-none-any.whl

Download URL sequences-0.0.8-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0597a42444278a895c07794e0e407b6191822c13b07cc2d0aa38f7012976745c
BLAKE2b-256 checksum
How to use checksums
ef4fb4d63843579c3d7fc25fcfd872d05f28509fdb94348c0eeac82158abb407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page