Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ombucha/python-oeis

https://raw.githubusercontent.com/Ombucha/python-oeis/main/banner.png

PyPI version PyPI downloads Lines of code Repository size

About

python-oeis is a Python library for exploring and retrieving integer sequences from the Online Encyclopedia of Integer Sequences (OEIS). Use it to search for sequences by keywords, fetch classic sequences like the Fibonacci numbers (A000045), primes (A000040), or your favorite obscure sequence, and access OEIS metadata programmatically.

Requirements

Installation

Install the latest stable release from PyPI:

# Unix / macOS
python3 -m pip install "python-oeis"

# Windows
py -m pip install "python-oeis"

To install the development version from GitHub:

git clone https://github.com/Ombucha/python-oeis
cd python-oeis
pip install .

Usage Example

Query the OEIS for sequences, just like searching for A-numbers or keywords on the OEIS website:

import oeis

# Search for sequences related to 'prime numbers'
results = oeis.search('prime numbers')
for seq in results[:3]:
    print(seq.id, seq.name, seq.data[:10])

# Fetch the Fibonacci sequence (A000045)
fib = oeis.Sequence('A000045')
print(fib.name)
print(fib.data[:10])  # First 10 Fibonacci numbers

Links

About

A basic API wrapper for OEIS.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages