Wolfram Research

Function Repository Resource:

OEISSequenceData

Source Notebook

Access sequences and metadata from The Online Encyclopedia of Integer Sequences

Contributed by: Jesse Friedman

ResourceFunction["OEISSequenceData"][id]

gives the beginning of the sequence with the given ID.

ResourceFunction["OEISSequenceData"][id,property]

gives the value of the specified property for the sequence with the given ID.

ResourceFunction["OEISSequenceData"][{id1,id2,}]

gives the beginning of each of the sequences with the given IDs.

ResourceFunction["OEISSequenceData"][{id1,id2,},property]

gives the value of the specified property for each of the sequences with the given IDs.

Details and Options

The following properties can be used in ResourceFunction["OEISSequenceData"][id, property]:
"IDNumber" the sequence's OEIS ID number as an integer
"IDString" the sequence's OEIS "A-number" as a string
"FormerIDStrings" a list of any other forms of ID strings the sequence may have had in previous publications
"Sequence" the beginning of the sequence, as a list of integers
"Name" the name of the sequence
"Comments" a list of any notes or comments on the sequence
"References" a list of references for the sequence
"Links" a list of links related to the sequence
"LinksHTML" a list of links related to the sequence, as raw HTML
"Formulae" a list of formulae for the sequence
"Example" a list of examples to illustrate the initial terms of the sequence
"CodeMaple" code in Maple to produce the sequence
"CodeWolframLanguage" code in the Wolfram Language to produce the sequence, as held expressions
"CodeWolframLanguageStrings" code in the Wolfram Language to produce the sequence, as the original strings
"CodeOther" code in other programming languages to produce the sequence
"CrossreferenceLines" a list of crossreferences to related sequences
"CrossreferenceIDNumbers" a list of crossreferences to related sequences, by the ID number of each as an integer
"ReferenceCount" the number of sequences that reference this sequence
"Keywords" a list of keywords describing the sequence
"Offset" the subscript of the first term in the sequence, or the number of digits before the decimal point if the sequence gives the decimal expansion of a constant
"Author" the person or persons who contributed the sequence
"Extensions" information about edits, extensions, or error corrections to the sequence
"Revision" the revision number of this version of the sequence
"DateCreated" the date that the sequence was first contributed
"DateModified" the date that the sequence was last modified
"Dataset" a Dataset of all properties of the sequence
In ResourceFunction["OEISSequenceData"][id, …], id can be either an integer or an OEIS “A-number” like "A123456"

Examples

Basic Examples

Get the beginning of sequence A269160:

In[1]:=
ResourceFunction["OEISSequenceData"][269160]
Out[1]=

Get a Dataset of all properties of the sequence:

In[2]:=
ResourceFunction["OEISSequenceData"][269160, "Dataset"]
Out[2]=

Scope

Get the name of sequence A004100:

In[3]:=
ResourceFunction["OEISSequenceData"][4100, "Name"]
Out[3]=

Get the name of the same sequence by specifying its full “A-number” string:

In[4]:=
ResourceFunction["OEISSequenceData"]["A004100", "Name"]
Out[4]=

Applications

Plot the initial terms of a sequence:

In[5]:=
ListLinePlot[ResourceFunction["OEISSequenceData"][269160]]
Out[5]=

Get Wolfram Language code that will produce the sequence:

In[6]:=
wlCode = ResourceFunction["OEISSequenceData"][269160, "CodeWolframLanguage"]
Out[6]=

The code is wrapped in HoldComplete for security; release the hold so it is evaluated:

In[7]:=
wlSequence = ReleaseHold[wlCode]
Out[7]=

Plot these newly-calculated terms:

In[8]:=
ListLinePlot[wlSequence]
Out[8]=

Properties and Relations

ResourceFunction["OEISSequence"]["id"] is equivalent to OEISSequenceData["id"]:

In[9]:=
ResourceFunction[
ResourceObject[
Association[
    "Name" -> "OEISSequence", "ShortName" -> "OEISSequence", "UUID" -> "12010764-9f22-4e11-9ecf-3310f9f9e7d4", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Return the list provided by the OEIS for a \
given OEIS sequence number", "RepositoryLocation" -> URL[
      "https://www.wolframcloud.com/objects/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$\
83e5783b1cb54fb8a9f1819c50935826`OEISSequence", "FunctionLocation" -> CloudObject[
      "https://www.wolframcloud.com/obj/bb406b01-d308-49cc-9402-\
42e3af604c25"]], ResourceSystemBase -> "https://www.wolframcloud.com/objects/\
resourcesystem/api/1.0"]]["A004100"] === ResourceFunction["OEISSequenceData"]["A004100"]
Out[9]=

ResourceFunction["OEISSequence"] may be significantly faster for some records with large amounts of metadata, as it only has to retrieve and parse the sequence itself:

In[10]:=
AssociationMap[First@AbsoluteTiming[#["A000045"]] &, {ResourceFunction[
ResourceObject[
Association[
    "Name" -> "OEISSequence", "ShortName" -> "OEISSequence", "UUID" -> "12010764-9f22-4e11-9ecf-3310f9f9e7d4", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Return the list provided by the OEIS for a \
given OEIS sequence number", "RepositoryLocation" -> URL[
      "https://www.wolframcloud.com/objects/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$\
83e5783b1cb54fb8a9f1819c50935826`OEISSequence", "FunctionLocation" -> CloudObject[
      "https://www.wolframcloud.com/obj/bb406b01-d308-49cc-9402-\
42e3af604c25"]], ResourceSystemBase -> "https://www.wolframcloud.com/objects/\
resourcesystem/api/1.0"]], ResourceFunction["OEISSequenceData"]}]
Out[10]=

Possible Issues

The “CodeOther” property gives all code in a single string:

In[11]:=
ResourceFunction["OEISSequenceData"][720, "CodeOther"]
Out[11]=

Neat Examples

Get the names of all the sequences cross-referenced by a sequence:

Make a word cloud from the names:

In[12]:=
WordCloud[DeleteStopwords@Flatten@TextWords@names]
Out[12]=

Resource History

Source Metadata

Related Resources

License Information