Math::N...:Perrin(3)

πŸ“¦
version 75 Β· 2 versions
, in fedora 43

πŸ’– 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 the i that 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