Math::NumSeq::Perrin -- Perrin sequence
use Math::NumSeq::Perrin; my $seq = Math::NumSeq::Perrin->new; my ($i, $value) = $seq->next;
The Perrin sequence,
3, 0, 2, 3, 2, 5, 5, 7, 10, 12, 17, 22, 29, 39, 51, etc
which is the recurrance
P(i) = P(i-2) + P(i-3)
starting from 3,0,2. So for example 29 is 12+17.
12, 17, 22, 29 | | | +---+-------+
See "FUNCTIONS" in Math::NumSeq for the behaviour common to all path classes.
$seq = Math::NumSeq::Perrin->new (length => $integer)
Create and return a new sequence object.
$value = $seq->ith($i)
Return the $i'th value from the sequence.
$i
Math::NumSeq, Math::NumSeq::Fibonacci
To install Math::NumSeq, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::NumSeq
CPAN shell
perl -MCPAN -e shell install Math::NumSeq
For more information on module installation, please visit the detailed CPAN module installation guide.