++ed by:
Kevin Ryde
and 1 contributors

# NAME

Math::NumSeq::DedekindPsiSteps -- psi function until 2^x*3^y

# SYNOPSIS

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

# DESCRIPTION

This sequence is the how many repeated applications of the Dedekind psi function are required to reach a number of the form 2^x*3^y.

``    0,0,0,0,1,0,1,0,0,1,1,0,2,1,1,0,1,0,2,1,1,1,1,0,2,2,0,1,2,...``

The psi function is

``````    psi(n) =        product          (p+1) * p^(e-1)
prime factors p^e in n``````

The p+1 means that one copy of each distinct prime in n is changed from p to p+1. That p+1 is even, so although the value has increased the prime factors are all less than p. Repeated applying that reduction eventually reaches just primes 2 and 3 in some quantity.

For example i=25 requires 2 steps,

``````    psi(25) = (5+1)*5 = 30 = 2*3*5
then
psi(30) = (2+1)*(3+1)*(5+1) = 72 = 2*2*2*3*3``````

If i is already 2s and 3s then it's considered no steps are required and the value is 0. For example at i=12=2*2*3 the value is 0.

# FUNCTIONS

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

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

Create and return a new sequence object.

## Random Access

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

Return the number of repeated applications of the psi function on `\$i` required to reach just factors 2 and 3.

This requires factorizing `\$i` and in the current code a hard limit of 2**32 is placed on `\$i`, in the interests of not going into a near-infinite loop. Above that the return is `undef`.