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

NAME

Math::NumSeq::OEIS -- number sequence by OEIS A-number

SYNOPSIS

 use Math::NumSeq::OEIS;
 my $seq = Math::NumSeq::OEIS->new (anum => 'A000032');
 my ($i, $value) = $seq->next;

DESCRIPTION

This module selects a NumSeq by its Online Encyclopedia of Integer Sequences A-number.

If there's NumSeq code implementing the sequence then that's used, otherwise files if available. See Math::NumSeq::OEIS::Catalogue for querying the available A-numbers.

Files should be in an OEIS directory in the user's home directory. It can be the HTML, "internal" format, B-file, or A-file.

    ~/OEIS/A000032.html
    ~/OEIS/A000032.internal
    ~/OEIS/b000032.txt
    ~/OEIS/a000032.txt

    downloaded from:
    http://oeis.org/A000032
    http://oeis.org/A000032/internal
    http://oeis.org/A000032/b000032.txt
    http://oeis.org/A000032/a000032.txt

The "internal" format is more reliable for parsing than the HTML. The B-file or A-file alone can be used, but in that case there's no $seq->description() and only a few of the $seq->characteristic() attributes.

The a000000.txt or b000000.txt files are generally a long list of values (the a.txt longer than the b.txt, when available). Some sequences don't have them, only 30 or 40 sample values from HTML or internal page. Those few samples might be enough for fast growing sequences.

Sometimes more than one NumSeq module can generate a given OEIS sequence. For example Squares and Polygonal k=4 are both A000290. Math::NumSeq::OEIS tries to give the better or faster one.

Sometimes the OEIS has duplicates, ie. two A-numbers which are the same sequence. The code modules are setup with both A-numbers, where known, but the $seq->oeis_anum() method will generally read back as whichever is the "primary" one.

FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for the behaviour common to all path classes.

$seq = Math::NumSeq::OEIS->new (anum => 'A000000')

Create and return a new sequence object.

BUGS

There's a hard-coded stop at file values bigger than an IV or an NV mantissa (whichever is larger). The idea is not to lose precision reading into a float. Perhaps reading into Math::BigInt would be better, but perhaps when reading progressively unlike the current code which slurps the file in one go.

SEE ALSO

Math::NumSeq, Math::NumSeq::OEIS::Catalogue

HOME PAGE

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

LICENSE

Copyright 2010, 2011, 2012 Kevin Ryde

Math-NumSeq 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-NumSeq 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-NumSeq. If not, see <http://www.gnu.org/licenses/>.