Math::OEIS::Stripped - read the OEIS stripped file
my @values = Math::OEIS::Stripped->anum_to_values('A123456');
This is an interface to the OEIS stripped file
http://oeis.org/stripped.gz
downloaded and gunzipped to
~/OEIS/stripped
The stripped file contains each A-number and its sample values. There's usually about 180 characters worth of sample values but may be more or less.
The stripped file is sorted by A-number so the anum_to_values() lookup is a text file binary search (currently implemented with Search::Dict).
anum_to_values()
@values = Math::OEIS::Stripped->anum_to_values($anum)
$str = Math::OEIS::Stripped->anum_to_values_str($anum)
Return the values from the stripped file for an $anum string such as "A000001".
$anum
anum_to_values() returns a list of values, or an empty list if no such A-number. Values bigger than a usual Perl integer are automatically converted to Math::BigInt so as to preserve exact values.
Math::BigInt
anum_to_values_str() returns a string like "1,2,3,4", or undef if no such A-number. (The stripped file has a leading comma on its values list but this is removed here for convenience of subsequent split or similar.)
anum_to_values_str()
undef
split
Draft sequences may have an empty values list ",,". The return for them is the same as "no such A-number", reckoning they have no values yet.
Math::OEIS::Stripped->close()
Close the stripped file handle, if not already closed.
$obj = Math::OEIS::Stripped->new (key => value, ...)
Create and return a new Math::OEIS::Stripped object to read an OEIS stripped file. The optional key/value parameters can be
Math::OEIS::Stripped
filename => $filename default ~/OEIS/stripped fh => $filehandle
The default filename is ~/OEIS/stripped, or other directory per Math::OEIS->local_directories(). A different filename can be given, or an open filehandle. When a file handle is given the filename may be used for diagnostics and so can be helpfully given too.
filename
@values = $obj->anum_to_values($anum)
$str = $obj->anum_to_values_str($anum)
$filename = $obj->filename()
Return the filename from a given $obj object.
$obj
$filename = Math::OEIS::Stripped->default_filename()
$filename = $obj->default_filename()
Return the default filename which is used if no filename or fh option is given. default_filename() can be called either as a class method or object method.
fh
default_filename()
$obj->close()
Math::OEIS, Math::OEIS::Names
Math::OEIS
Math::OEIS::Names
http://user42.tuxfamily.org/math-oeis/index.html
Copyright 2010, 2011, 2012, 2013, 2014 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/.
To install Math::OEIS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::OEIS
CPAN shell
perl -MCPAN -e shell install Math::OEIS
For more information on module installation, please visit the detailed CPAN module installation guide.