Math::N...:Perrin(3)
π Math::N...:Perrin π
okay bestie, so this is the User Contributed Perl Documentation page for Math::N...:Perrin β yes the name is doing a little β¨ellipsisβ¨ thing, it's a whole vibe, don't worry about it. Let's get into it. π«Ά
β¨ NAME β¨
Math::NumSeq::Perrin β the Perrin sequence, fr fr π
πΈ SYNOPSIS πΈ
use Math::NumSeq::Perrin;
my $seq = Math::NumSeq::Perrin->new;
my ($i, $value) = $seq->next;
that's it. that's the whole entry point. iconic. π
π¦ DESCRIPTION π¦
So the Perrin sequence goes like this:
3, 0, 2, 3, 2, 5, 5, 7, 10, 12, 17, 22, 29, 39, 51, ... (A001608)
and it's built from the recurrence
P(i) = P(i-2) + P(i-3)
starting from 3,0,2. so basically each new number is the one from two steps back plus the one from three steps back, no cap. so for example 29 is 12+17. look at the lil diagram bestie it's literally so cute:
12, 17, 22, 29
| | ^
| | |
+---+---add-+
the way it just adds them together... obsessed. π
π₯ FUNCTIONS π₯
ngl there's a whole shared behaviour situation here β go peep "FUNCTIONS" in Math::NumSeq for the stuff common to all sequence classes. π
$seq = Math::NumSeq::Perrin->new (length => $integer)β makes you a brand new sequence object and hands it back. main character energy. β¨
π Random Access π
$value = $seq->ith($i)β gimme the$i'th value from the sequence, pls and thank u.$i = $seq->value_to_i_estimate($value)β gives you an estimate of theithat matches up with$value. yes bestie it's an estimate, we said what we said. π
π SEE ALSO π
Math::NumSeq, Math::NumSeq::Fibonacci β go say hi to the cousins π
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
π LICENSE π
Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020, 2021 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/>.
bestie the all-caps WARRANTY stuff is not me being dramatic, that's literally how it's written and it means what it says π
and that's the whole page! mwah π«Ά this lil masterpiece is running on perl v5.42.0 and it was dated 2025-07-25. stay slaying, go read your sequences β¨πΈπ
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms