OEIS (oeis v0.7.1)
Copy MarkdownA client for the On-Line Encyclopedia of Integer Sequences (OEIS).
Summary
Functions
Fetches extended sequence terms from the associated b-file.
Fetches sequences referenced in the xref field concurrently.
Searches the OEIS database for sequences.
Functions
Fetches extended sequence terms from the associated b-file.
Parses the linked b-file (e.g., b000001.txt) to extract additional terms, replacing the existing data field.
It also extracts any comments within the b-file and appends them to the sequence's comment list,
annotated with their line numbers (e.g., [b-file L10] comment).
Options
:timeout(integer): Request timeout in milliseconds (default: 15,000).
Returns
{:ok, updated_sequence}: Success.{:error, %{original_sequence: seq, message: msg}}: Failure.
Examples
iex> {:single, seq} = OEIS.search("A000001")
iex> {:ok, updated} = OEIS.fetch_more_terms(seq)
Fetches sequences referenced in the xref field concurrently.
Options
:timeout(integer): Request timeout in milliseconds (default: 15,000).:max_concurrency(integer): Concurrency limit for parallel tasks (default: 5).:stream(boolean): Iftrue, returns an Elixir Stream that lazily fetches and emits results (default:false).
Returns
[sequence]: List of successfully fetchedOEIS.Sequencestructs.Enumerable.t(): A stream ofOEIS.Sequencestructs ifstream: true.
Examples
iex> {:single, seq} = OEIS.search("A000045")
iex> refs = OEIS.fetch_xrefs(seq)
Searches the OEIS database for sequences.
The first argument can be:
- A string ID (e.g.,
"A000055"). - A list of integers (e.g.,
[1, 2, 3, 5, 8]). - A string of integers (e.g.,
"1, 2, 3, 5, 8"or"1 2 3 5 8"). - A keyword list of search parameters (see below).
Options
:may_truncate(boolean): Iftrue(default), truncates the provided terms and removes leading 0s/1s to increase the chances of a match.:respect_sign(boolean): Iftrue(default), respects signs. Iffalse, ignores signs.:timeout(integer): Request timeout in milliseconds (default: 15,000).:max_concurrency(integer): Limit for parallel tasks (default: 5).:start(integer): Starting index for results (default: 0).:stream(boolean): Iftrue, returns an Elixir Stream that lazily fetches and emits results (default:false).
Parameters (Keyword List)
:sequence(list/string): Terms to search for.:id(string): OEIS A-number.:keyword(string): Filter keyword (e.g.,"core").:author(string): Author name (automatically wildcards:*name*).:query(string): General query string.
Returns
{:single, sequence}: Exact ID match.{:multi, [sequence]}: Multiple matches found.{:partial, [sequence]}: Partial results (more likely available).{:no_match, message}: No results found.
Examples
iex> OEIS.search("A000045")
{:single, %OEIS.Sequence{id: "A000045", ...}}
iex> OEIS.search([1, 2, 3, 5, 8])
{:multi, [%OEIS.Sequence{id: "A000045", ...}]}
iex> OEIS.search(author: "Sloane", keyword: "core", start: 10)
{:partial, [...]}
iex> OEIS.search(query: "partitions", stream: true)
#Stream<...>