The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::OEIS::Stripped - read the OEIS stripped file

SYNOPSIS

 my @values = Math::OEIS::Stripped->anum_to_values('A123456');

DESCRIPTION

This is an interface to the OEIS stripped file

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).

FUNCTIONS

@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_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.

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.)

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.

Oopery

$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

    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.

@values = $obj->anum_to_values($anum)
$str = $obj->anum_to_values_str($anum)

Return the values from the stripped file for an $anum string such as "A000001".

$filename = $obj->filename()

Return the filename from a given $obj object.

$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.

$obj->close()

Close the stripped file handle, if not already closed.

SEE ALSO

Math::OEIS, Math::OEIS::Names

HOME PAGE

http://user42.tuxfamily.org/math-oeis/index.html

LICENSE

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/.