Kevin Ryde > Math-NumSeq-67 > Math::NumSeq::ConcatNumbers



Annotate this POD



Open  0
View/Report Bugs
Module Version: 67   Source   Latest Release: Math-NumSeq-69


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


 use Math::NumSeq::ConcatNumbers;
 my $seq = Math::NumSeq::ConcatNumbers->new;


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 Kevin Ryde




syntax highlighting: