# NAME

Math::NumSeq::NumAronson -- numerical version of Aronson's sequence

# SYNOPSIS

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

# DESCRIPTION

This is a self-referential sequence by Cloitre, Sloane and Vandermast,

The sequence begins

``````    1, 4, 6, 7, 8, 9, 11, 13, ...
starting i=1``````

Starting with a(1)=1 the rule is "n is in the sequence iff a(n) is odd". The result is a uniform pattern 3 steps by 1 then 3 steps by 2, followed by 6 steps by 1 and 6 steps by 2, then 12, 24, 48, etc.

``````    1,
4,
6,  7,  8,                   # 3 steps by 1
9,  11, 13,                  # 3 steps by 2
15, 16, 17, 18, 19, 20,      # 6 steps by 1
21, 23, 25, 27, 29, 31,      # 6 steps by 2
# 3*2^k steps by 1
# 3*2^k steps by 2``````

In general

``````    numaronson(9*2^k-3+j) = 12*2^k - 3 + (3*j+abs(j))/2
where -3*2^k <= j < 3*2^k``````

The (3*j+abs(j))/2 part is the step, going by 1 if j<=0 and by 2 if j>0.

# FUNCTIONS

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

`\$seq = Math::NumSeq::NumAronson->new ()`

Create and return a new sequence object.

## Random Access

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

Return the `\$i`th value in the sequence.

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

Return true if `\$value` occurs in the sequence.