Math::N...tNumbers(3)
π Math::NumSeq::ConcatNumbers β bestie edition π
okay so real quick, this is from the User Contributed Perl Documentation section, and the page you're on is Math::NumSeq::ConcatNumbers(3). it's a whole module, it does one cute little thing, and honestly? it slays.
β¨ NAME β¨
Math::NumSeq::ConcatNumbers β literally just concatenate the digits of i, i+1 π«Ά
πΈ SYNOPSIS πΈ
use Math::NumSeq::ConcatNumbers;
my $seq = Math::NumSeq::ConcatNumbers->new;
my ($i, $value) = $seq->next;
that's it. that's the whole vibe. you make a sequence object, you call next, you get an index and a value. iconic behavior fr fr.
π¦ DESCRIPTION π¦
so what it does is take i and i+1 and just⦠smush their digits together. no space, no separator, no chill. starting from i=0, the sequence goes:
1, 12, 23, 34, 45, 56, 67, 78, 89, 910, 1011, 1112, ...
default is decimal obviously, but if you pass the optional radix parameter you can pick another base. do whatever, live your truth π
here's the cute little pattern tea: since i and i+1 usually have the same number of digits, the concatenated value ends up with an even number of digits. the exception is at i=9 i+1=10, or i=99 i+1=100, etc, i=99..99 when the resulting value has an odd number of digits. so it's even even even evenβ¦ and then not. we love a plot twist π
and because it's an even number of digits, you get these power gaps between for instance 89 and 1011, then 998999 and 10001001. big jumps. main character energy.
π₯ Concat Count π₯
the option concat_count => $c picks how many of i,i+1,i+2,i+3,etc get concatenated. like, how many besties are we squishing into one number.
so for example concat_count => 3 gives you:
12, 123, 234, 345, 456, 567, 678, 789, 8910, 91011, 101112, 111213, ...
and heads up: concat_count => 1 means all integers (the same as Math::NumSeq::All). so if you wanted plain old integers, you already had them, bestie. periodt.
π FUNCTIONS π
for the behavior that's common to all path classes, go read "FUNCTIONS" in Math::NumSeq. that's the shared lore.
$seq = Math::NumSeq::ConcatNumbers->new ()$seq = Math::NumSeq::ConcatNumbers->new (radix => $r, concat_count => $c)
Create and return a new sequence object. boom, you got a sequence. go forth and iterate π
β Random Access β
$value = $seq->ith($i)
Return the concatenation of $i, "$i+1", etc. so you can just jump straight to whatever index you want, no scrolling, no waiting. we love a shortcut π§
π SEE ALSO π
Math::NumSeq::AllMath::NumSeq::AllDigits
go read those too, they're the cousins π«Ά
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2016, 2018, 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.
fr fr, no warranty, that part is not a vibe, that part is real π
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 generated with perl v5.42.0 on 2025-07-25 β mwah, go concatenate something π β¨
π¦ 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