Math::OEIS::Names - read the OEIS names file
use Math::OEIS::Names; my $name = Math::OEIS::Names->anum_to_name('A123456');
This is an interface to the OEIS names file. The file should be downloaded and unzipped to ~/OEIS/names,
cd ~/OEIS wget http://oeis.org/names.gz gunzip names.gz
names is a very large file listing each A-number and the sequence name. The name is a single line description, sometimes a slightly long line.
The names file is sorted by A-number so
anum_to_name() is a text file binary search (currently implemented with Search::Dict).
$name = Math::OEIS::Names->anum_to_name($anum)
For a given
$anumstring such as "A000001" return the sequence name as a string, or if not found then return
$namemay contain non-ASCII characters. In Perl 5.8 up, they're returned as Perl wide chars. In earlier Perl,
$nameis the native encoding of the names file (which is UTF-8).
If running in
perl -Ttaint mode then
$nameis tainted in the usual way for reading from a file.
Close the names file, or do nothing if already closed or never opened.
$obj = Math::OEIS::Names->new (key => value, ...)
Create and return a new
Math::OEIS::Namesobject to read an OEIS "names" file. The optional key/value parameters are
filename => $filename default ~/OEIS/names fh => $filehandle
The default file is per
default_filename()below. A different filename can be given or an open filehandle
filenamecan be given too and might be used in diagnostics.
$name = $obj->anum_to_name($anum)
For a given
$anumstring such as "A000001", return the sequence name as a string, or if not found then return
$filename = $obj->filename()
Return the names filename from a given
$objobject. This is the
filenameparameter if given, or filename which was determined by
$filename = Math::OEIS::Names->default_filename()
$filename = $obj->default_filename()
Return the default filename which is used if no
fhoption is given. The file is names in
Close the file handle, or do nothing if already closed.
($anum,$str) = Math::OEIS::Names->line_split($line)
Split a line from the names file into A-number and text.
$lineshould be like
A123456 some descriptive text
Any trailing newline on
$lineis not an A-number and text like this then return an empty list. The names file starts with some comment lines (
#) and they get this empty return.
OEIS files page http://oeis.org/allfiles.html
Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Kevin Ryde
Math-OEIS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-OEIS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-OEIS. If not, see http://www.gnu.org/licenses/.