oeis-seek
Identify the OEIS sequence a list of integers belongs to - even when the raw numbers are not in OEIS but a simple transform of them is.
oeis-seek works offline against a local copy of the
OEIS bulk dump. You download the dump once, then look up
sequences with no network calls and no rate limits.
Install
Install the released CLI from PyPI (the package is oeis-seek; it installs a
oeis-seek command):
uv tool install oeis-seek # or: pipx install oeis-seek, or: pip install oeis-seek
Or work from a clone:
uv sync
Usage
First, download and index the OEIS dump (one time; re-run to refresh):
oeis-seek update
Then identify a sequence:
oeis-seek 0,1,1,2,3,5,8,13 # -> A000045 (Fibonacci), raw match
oeis-seek 2,6,12,20,30,42 # -> hit via first differences
echo "1 2 6 24 120" | oeis-seek # terms from stdin
oeis-seek 2,6,12,20 --json # machine-readable output
oeis-seek 2,6,12,20 --limit 5 # cap results (default 10)
Terms may be comma- or whitespace-separated, passed as arguments or piped on
stdin. At least four terms are required by default (--min-terms lowers it).
How it works
Three ideas do the work.
The matcher (framed-substring contiguous match)
The index stores each sequence's terms as a comma-framed string,
,0,1,1,2,3,5,. A lookup frames the query the same way, ,1,2,3,5,, and asks
which stored sequences contain that substring. Framing the run on both sides
makes substring containment exactly the contiguous-subsequence predicate OEIS
itself uses: term boundaries hold (2,3 cannot match inside 23), terms must be
adjacent, and signs are respected. At ~370k sequences this resolves well under a
second, so the MVP needs no inverted index.
The transforms
Before matching, oeis-seek also tries simple transforms of your input and looks
each result up:
- raw - the input as given
- first differences -
a(n+1) - a(n) - partial sums - running totals
- consecutive ratios -
a(n+1) / a(n)(later over earlier), used only when every ratio divides exactly, e.g.1, 2, 6, 24becomes2, 3, 4 - higher-order differences - first differences applied repeatedly (orders 2 and 3)
- a(n) - n and a(n) / n - subtract or divide by the 0-based index (the latter integer-only)
- absolute values -
abs(a(n)), to recognize a signed sequence by magnitude
Transforms live in a registry, so adding more later is one function plus one registration.
The ranking
Every hit gets a deterministic, explainable score. Matches needing no transform
rank above transformed ones, more matched terms rank higher, and sequences in
OEIS's curated core set are boosted so canonical sequences outrank obscure ones
that merely share a run. A run found near a sequence's opening is weak extra
evidence over one buried deep inside, and ties resolve by ascending A-number so
output is stable. All scoring weights live in one place, and each result tells
you which transform found it and why it ranked where it did.
Development
Lint, format, and test:
uv run ruff check .
uv run ruff format .
uv run pytest
CI runs ruff and pytest on every push and pull request.
To refresh the embedded OEIS core set:
uv run python tools/generate_core_set.py
Metadata
Release files for oeis-seek 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| oeis_seek-0.1.0.tar.gz | 26.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| oeis_seek-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.5 kB
Release files / oeis_seek-0.1.0.tar.gz
| Download URL | oeis_seek-0.1.0.tar.gz |
|---|---|
| Size | 26.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7df1bdfcd172019d17bbd609be30274696bd5b48555cc5c1d1087d569e9e9e25
|
|
BLAKE2b-256 checksum How to use checksums |
b01fb424c560460a5046a9c6fbf1d4f4ef8da8b7dea0e11259bae4c23291d740
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / oeis_seek-0.1.0-py3-none-any.whl
| Download URL | oeis_seek-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb85b1d1d596b105b9692396164ca3d0f5c85bcfea2158dd30251fa1d54d550e
|
|
BLAKE2b-256 checksum How to use checksums |
27b6ceadc5112980e7004a2fa7ab234ffd49217efe105a80903e6fa8113e0af7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|