-
Notifications
You must be signed in to change notification settings - Fork 1
Home
When you go on computing: if you are doing repetitive and boring things, is because you are not working in a proper way. So I decided to write some code to help myself with the worst part of my projects. And as this code began to grow and became more complex, thought it would be good idea to gather all together in the same Mathematica Package and to share it on the internet.
This code includes functions that can make your life easier if you a using the information from OEIS in your archives: for citation in documents or blogs, for programming sequences, or for many other purposes.
- Author: Enrique Pérez Herrero
- Date: 24/Nov/2015
- Project Pages: http://psychedelic-geometry.github.io/OEIS-Mathematica
- Licence: GNU GENERAL PUBLIC LICENSE v3.0
- Blog: http://psychedelic-geometry.blogspot.com/
Version:
- V 1.0, 26 August 2010, Testing...
- V 2.0, 28 November 2010, Old links are no longer valid.
Changes:
- 29/Aug/2010 - Added
OEISbFile
function and exporting to HTML - 28/Nov/2010 - Code rebuilt due to changes in OEIS, old links are no longer valid.
- 04/Jun/2011 - Fixed Unicode LF, instead of Window's CRLF for bFiles.
- 25/Jan/2015 - Repository created at GitHub.
Functions
OEISTotalNumberOfSequences
OEISValidateIDQ
OEISImport
OEISURL
OEISFunction
OEISExport
OEISbFile
https://github.com/Psychedelic-Geometry/OEIS-Mathematica/archive/master.zip
- Loading Package into a Mathematica notebook:
<<OEIS`
In[1]:= OEISImport["A014321", "Description"]
Out[1]= The next new gap between successive odd primes (divided by 2).
In[2]:= OEISImport["A080321", "Data"]
Out[2]= {{0,0},{1,4},{2,428},{3,58747},{4,1758473969},{5,340760636747},
{6,14410746502617904},{7,673020037180959760871},
{8,1736622037158911219053381734718},
{9,400539731185759177060380684246324}}
In[3]:= OEISImport["A117321","Date"]
Out[3]= {Mar,07,2006}
In[4]:= OEISImport["A014321", "Author"]
Out[4]= {Hynek Mlcousek}
In[5]:= OEISImport["A030337","Image"]
Out[5]=
[[File:Sample for A030337-Image sample.gif|border|200px]]
In[6]:=ListPlot[OEISImport["A094358","bFile"],Joined->True]
Out[6]= (Plot Image)
In[7]:= OEISImport["A094358","MinData"]
Out[7]= 1
In[8]:= OEISImport["A094358","MaxData"]
Out[8]= 1314
- Exporting Formats:
File Extension | Exported data: |
---|---|
*.gp | Code to add help for PARI/GP functions |
*.m | Code to add help for Mathematica |
*.txt, *.xls, *.csv, *.tsv, *.dat | Data files with sequence values. |
*.jpg, *.jpeg, *.jp2, *.j2k, *.bmp, *.pgn, *.gif, *.tiff, *.tif | Image plot |
*.bib | BibTeX citation to OEIS Sequences |
*.htm, *.html | HTML citation to OEIS Sequences |
The input for the function can be a String or a List of Strings:
In[1]:=OEISExport[{"A026588", "A111084"}, "example.bib"]
Out[1]=example.bib
- Content of file:
example.bib
@MISC{oeisA026588,
AUTHOR={},
TITLE={The {O}n-{L}ine {E}ncyclopedia of {I}nteger {S}equences},
HOWPUBLISHED={\href{http://oeis.org/A026588}{A026588}},
MONTH={},
YEAR={},
NOTE={Duplicate of A026572.}
}
@MISC{oeisA111084,
AUTHOR={N. J. A. Sloane},
TITLE={The {O}n-{L}ine {E}ncyclopedia of {I}nteger {S}equences},
HOWPUBLISHED={\href{http://oeis.org/A111084}{A111084}},
MONTH={Nov},
YEAR={2005},
NOTE={Where records occur in A111267.}
}
In[2]:= OEISExport[{"A026588","A111084","A131473"},"code_for_PARIGP.gp"]
Out[2]= code_for_PARIGP.gp
- Content of file:
code_for_PARIGP.gp
addhelp(A026588,"A026588: Duplicate of A026572.");
addhelp(A111084,"A111084: Where records occur in A111267.");
addhelp(A131473,"A131473: a(n)=n^6-n.");
In[3]:= OEISExport[{"A026588","A111084","A131473"},"code_for_Mathematica.m"]
Out[3]= code_for_Mathematica.m
- Content of file:
code_for_Mathematica.m
A026588::usage="A026588[n]: Duplicate of A026572.";
A111084::usage="A111084[n]: Where records occur in A111267.";
A131473::usage="A131473[n]: a(n)=n^6-n.";
- Example with EXCEL:
In[4]:= OEISExport[{"A026588","A111084","A131473"},"data.xls"]
Out[4]= {A026588_data.xls,A111084_data.xls,A131473_data.xls}
In[5]:=OEISExport[{"A040414", "A050414", "A002323", "A026588"}, "test.html"]
Out[5]= test.html
- Content of file:
test.html
<a name="oeisA040414">[1]-</a> N. J. A. Sloane, The On-Line Encyclopedia of Integer Sequences.
<a href=http://oeis.org/A040414">A040414</a>: Continued fraction for sqrt(435).<br/>
<a name="oeisA050414">[2]-</a> Jud McCranie, The On-Line Encyclopedia of Integer Sequences.
<a href=http://oeis.org/A050414">A050414</a>: Numbers n such that 2^n - 3 is prime.<br/>
<a name="oeisA002323">[3]-</a> N. J. A. Sloane, The On-Line Encyclopedia of Integer Sequences.
<a href=http://oeis.org/A002323">A002323</a>: Fermat remainders.<br/>
<a name="oeisA026588">[4]-</a> The On-Line Encyclopedia of Integer Sequences.
<a href=http://oeis.org/A026588">A026588</a>: Duplicate of A026572.<br/>
In[6]:=OEISExport[{"A026518", "A111284"}, "example.wiki"]
Out[6]:=example.wiki
- Content of file:
example.wiki
A026518: a(n) = length of n-th run of identical symbols in A026517.
A111284: Number of permutations avoiding the patterns {2143,2341,2413,2431,3142,3241,3412,3421,4123,4213,4231,4321,4132,4312};
number of strong sorting class based on 2143.
Function: OEISFunction[ID, Opts]
:
The options Opts
, are True
by default, and they can be modified as:
To skip the addition of help to the function:
OEISFunction[ID,AddHelp->False]
To skip the data from the bFile:
OEISFunction[ID,bFile->False]
To do not print on the screen the information outputed:
OEISFunction[ID,Output->False]
- Example of use:
In[5]:= OEISFunction["A094358"]
A094358(n): Squarefree products of factors of Fermat numbers (A023394).
Link-1: http://oeis.org/A094358
Link-2: http://oeis.org/b094358.txt
Help Added: True
Loaded data from bFile: True
Loaded data from Sequence: False
Data available: Table of n, A094358(n) for n=1..1314
From now on, we can use the function with all data already loaded on it:
In[6]:= A094358[1314]
Out[6]= 2917004348489729
Function: OEISbFile[ID,Vmax,filename]
- Example:
We can define the function first, but if we do not define it, the code creates the function and preloads all available data from OEIS:
In[5]:=A040414[0]:=20;
A040414[n_]:=Part[{1,5,1,40},1+Mod[n-1,4}};
In[6]:=OEISbFile["A040414", 200]
Out[6]=b040414.txt
- Todd Gayley, [1994 Mathematica Developer Conference, Wolfram Research, Inc., Tutorial](http://library.wolfram.com/infocenter/Conferences/184/ Mathematica Package Design)
- OEIS Sequence Tools
- [GitHub Repository](https://github.com/Psychedelic-Geometry OEIS-Mathematica)