and 1 contributors

NAME

Math::NumSeq::UndulatingNumbers -- numbers with alternating digits ABABAB...

SYNOPSIS

use Math::NumSeq::UndulatingNumbers;
my \$seq = Math::NumSeq::UndulatingNumbers->new (radix => 10);
my (\$i, \$value) = \$seq->next;

DESCRIPTION

This is the sequence of numbers with digits ABABAB... alternating between two values,

0 ... 99,
101, 111, 121, 131, ... 191,
202, 212, 222, 232, ... 292,
...
909, 919, 929, 939, ... 999,
1010, 1111, 1212, ... 1919,
...

Numbers with just 1 or 2 digits are A or AB and are considered of undulating form. This means all numbers up to 99 are undulating.

The default is decimal or the optional radix=>\$r can select another radix.

In binary the only two digits are 0 and 1 and the high digit must be 1, so it ens up being just 101... and 111...

0, 1, 10, 11, 101, 111, 1010, 1111, 10101, 11111, ...
(in binary)

FUNCTIONS

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

\$seq = Math::NumSeq::UndulatingNumbers->new ()
\$seq = Math::NumSeq::UndulatingNumbers->new (radix => \$r)

Create and return a new sequence object. The default radix is 10.

\$bool = \$seq->pred(\$value)

Return true if \$value is an undulating number, ie. has digits of the form ABABAB...

\$i = \$seq->value_to_i_floor(\$value)
\$i = \$seq->value_to_i_estimate(\$value)

Return the i for the undulating number <= \$value.

Math::NumSeq