++ed by:
Kevin Ryde
and 1 contributors

# NAME

Math::NumSeq::PrimeIndexOrder -- order of primeness by primes at prime indexes

# SYNOPSIS

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

# DESCRIPTION

This is the order of primeness by Neil Fernandez, counting levels of prime at prime index iterations,

``````    http://www.borve.org/primeness/FOP.html

i     = 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17

value = 0, 1, 2, 0, 3, 0, 1, 0, 0, 0, 4, 0, 1, 0, 0, 0, 2, ...``````

Any composite has order 0. The order for a prime is based on whether its index in the list of all primes 2,3,5,7,11,etc is a prime and how many times that prime index descent can be repeated.

For example i=17 is a prime and is at index 7 in the list of all primes. That index 7 is a prime too and is at index 4. Then stop there since 4 is not a prime. Two iterations to reach a non-prime means i=17 has value 2 as its order of primeness.

## Primes Only

Option `on_values => 'primes'` selects the orders of just the primes 2,3,5,7,etc. The effect is to eliminate the 0s from the sequence.

``    1, 2, 3, 1, 4, 1, 2, 1, 1, 1, 5, 1, 2, 1, 1, 1, ...``

# FUNCTIONS

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

`\$seq = Math::NumSeq::PrimeIndexOrder->new (level => \$n)`

Create and return a new sequence object.