Math::NumSeq::DedekindPsiSteps -- psi function until 2^x*3^y
use Math::NumSeq::DedekindPsiSteps; my $seq = Math::NumSeq::DedekindPsiSteps->new; my ($i, $value) = $seq->next;
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.
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.
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::DedekindPsiSteps->new ()
Create and return a new sequence object.
$value = $seq->ith($i)
Return the number of repeated applications of the psi function on
$irequired to reach just factors 2 and 3.
This calculation requires factorizing
$iand in the current code after small factors a hard limit of 2**32 is enforced in the interests of not going into a near-infinite loop. Above that the return is
Copyright 2012, 2013, 2014 Kevin Ryde
Math-NumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-NumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.