# SYNOPSIS

`````` use Math::NumSeq::ReverseAddSteps;
my (\$i, \$value) = \$seq->next;``````

# DESCRIPTION

The number of steps to reach a palindrome by the digit "reverse and add" algorithm. For example the i=19 is 2 because 19+91=110 then 110+011=121 is a palindrome.

At least one reverse-add is applied, so an i which is itself a palindrome is not value 0, but wherever that minimum one step might end up. A repunit like 111...11 reverse-adds to 222...22 so it's always 1 (except in binary).

The default is to reverse decimal digits, or the `radix` parameter can select another base.

The number of steps can be infinite. In binary for example 3 = 11 binary never reaches a palindrome, and in decimal it's conjectured that 196 doesn't (and that is sometimes called the 196-algorithm). In the current code a hard limit of 100 is imposed on the search - perhaps something better is possible. (Some binary infinites can be recognised from their bit pattern ...)

# FUNCTIONS

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

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

Create and return a new sequence object.

## Random Access

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

Return the number of reverse-add steps required to reach a palindrome.

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

Return true if `\$value` occurs in the sequence, which simply means `\$value >= 0` since any count of steps is possible, or `\$value==-1` for infinite.