Math::N...eReplace(3)
β¨ NAME β¨
Math::NumSeq::ReReplace β bestie, it's a whole sequence of repeated replacements π
π¦ SYNOPSIS π¦
use Math::NumSeq::ReReplace;
my $seq = Math::NumSeq::ReReplace->new;
my ($i, $value) = $seq->next;
π DESCRIPTION π
okay so this is a sequence by David Madore and the whole vibe is: you keep replacing every N'th occurrence of a term with N, over and over, and honestly? iconic. π«Ά
1, 2, 1, 2, 3, 3, 1, 2, 4, 4, 3, 4, ...
as per, no cap:
David Madore, "have you seen this sequence?", sci.math.research, 24 Oct 2004, <http://sci.tech-archive.net/Archive/sci.math.research/2004-10/0218.html> <http://www.madore.org/~david/.misc/seq.png>
β¨ Stages β¨
so the generating procedure starts with literally all 1s, like:
stage 0: 1,1,1,1,1,1,1,1,1,1,1,1,...
then every second 1 gets changed to 2 π
stage 1: 1,2,1,2,1,2,1,2,1,2,1,2,...
then every third 1 gets changed to 3, and every third 2 gets changed to 3 too, like it's a group project and everyone's contributing:
stage 2: 1,2,1,2,3,3,1,2,1,2,3,3,...
then every fourth 1 becomes 4, every fourth 2 becomes 4, and every fourth 3 becomes 4. slay.
stage 3: 1,2,1,2,3,3,1,2,4,4,3,4,...
the way this works: the replacement by N of every *N*th is applied separately to the 1s, the 2s, the 3s, etc. remaining at each stage. it's giving meticulous. π
the optional stage => $n parameter limits the replacements to a given number of stages of the algorithm. the default -1 means unlimited. periodt. β¨
π FUNCTIONS π
see "FUNCTIONS" in Math::NumSeq for the behaviour common to all sequence classes, bestie π«Ά
$seq = Math::NumSeq::ReReplace->new ()$seq = Math::NumSeq::ReRound->new (stages => $integer)
create and return a new sequence object. π
$bool = $seq->pred($value)
return true if $value occurs in the sequence. and ngl, this merely means integer $value >= 1. that's the whole check. π
πΈ SEE ALSO πΈ
Math::NumSeq, Math::NumSeq::ReRound π
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html> π¦
π LICENSE π
Copyright 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/>.
and that's the whole page, bestie π this was perl v5.42.0, dated 2025-07-25, from the User Contributed Perl Documentation, and it lives at Math::N...eReplace(3) β go forth and replace every Nth thing, mwah πβ¨
π¦ 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