Math::NumSeq::ConcatNumbers -- concatenate digits of i, i+1


 use Math::NumSeq::ConcatNumbers;
 my $seq = Math::NumSeq::ConcatNumbers->new;
 my ($i, $value) = $seq->next;


The concatenation of i and i+1 as digits, starting from i=0,

    1, 12, 23, 34, 45, 56, 67, 78, 89, 910, 1011, 1112, ...

The default is decimal, or optional radix parameter selects another base.

Since the two i and i+1 usually have the same number of digits, the resulting concatenated value has 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.

Being an even number of digits makes power gaps between for instance 89 and 1011, then 998999 and 10001001.

Concat Count

Option concat_count => $c selects how many of i,i+1,i+2,i+3,etc are concatenated. For example concat_count => 3 gives

    12, 123, 234, 345, 456, 567, 678, 789, 8910, 91011, 101112, 111213, ...

concat_count => 1 means all integers (the same as Math::NumSeq::All).


See "FUNCTIONS" in Math::NumSeq for the behaviour common to all path classes.

$seq = Math::NumSeq::ConcatNumbers->new ()
$seq = Math::NumSeq::ConcatNumbers->new (radix => $r, concat_count => $c)

Create and return a new sequence object.

Random Access

$value = $seq->ith($i)

Return the concatenation of $i, $i+1, etc.


Math::NumSeq::All, Math::NumSeq::AllDigits



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.

You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <>.