Math::N...rnerRado(3)
π Math::N...rnerRado(3) π
okay bestie, gather round, because this is the Math::N...rnerRado(3) page β straight out of the User Contributed Perl Documentation, and it's giving mathematical baddie energy. no cap. π¦
β¨ NAME β¨
Math::NumSeq::KlarnerRado β Klarner-Rado sequences π
πΈ SYNOPSIS πΈ
use Math::NumSeq::KlarnerRado;
my $seq = Math::NumSeq::KlarnerRado->new;
my ($i, $value) = $seq->next;
literally three lines and you're in. slay. π
π DESCRIPTION π
so the way this works is iconic: you start with 1, and then for any k that's already in the sequence, these three cuties are also in the sequence:
2*k3*k+26*k+3
and that's it. that's the whole vibe. so the sequence goes 1,2,4,5,8,9,etc. β¨
π«Ά FUNCTIONS π«Ά
if you wanna know about the behaviour that all the sequence classes share, go look at "FUNCTIONS" in Math::NumSeq β that's the group chat everyone's in. π¬
$seq = Math::NumSeq::KlarnerRado->new ()$seq = Math::NumSeq::KlarnerRado->new (start => $n)
makes a brand new sequence object and hands it to you. π
the optional start param lets you kick things off from a value that isn't 1. heads up though β that changes the sequence, and ngl, generally bigger values thin out the sequence. so it's a whole different beast. π
$bool = $seq->pred($value)
returns true if $value shows up in the sequence. that's it, that's the function. β
π₯ FORMULAS π₯
π§ Predicate
okay this part is the main character moment. if you take value mod 6, you can tell whether it's a descendant of one of the 2*k, 3*k+2, or 6*k+3 forms β and that gives you one or two reduced values to go check for being in the sequence. it's giving recursion. π
here's the breakdown, one bullet per case because we're organised besties:
value mod 6 == 0β descendant of2kβ reduce tovalue/2value mod 6 == 1β descendant ofnone(nope, not a thing, sorry babe π)value mod 6 == 2β descendant of2k or 3k+2β reduce tovalue/2 and (value-2)/3value mod 6 == 3β descendant of6k+3β reduce to(value-3)/6value mod 6 == 4β descendant of2kβ reduce tovalue/2value mod 6 == 5β descendant of3k+2β reduce to(value-2)/3
the reduction dividing out 2, 3 or 6 makes the test logarithmic β¨ β except when 2mod6 gives you two reduced values to check, because then you've got double the homework. π
π SEE ALSO π
Math::NumSeq
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html> β go visit, it's cute π π
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 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/>.
no cap, read the license fr fr β free software is the moment, but the warranty situation is literally "we don't got one" π
and that's the whole page, bestie!! π this was perl v5.42.0, dated 2025-07-25, and it's the Math::N...rnerRado(3) manual β thanks for reading the whole thing, you're an icon, an absolute legend, periodt. π
β¨π¦π
π¦ 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