Math::N...tNumbers(3)

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

πŸ’– 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::All
  • Math::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