Math::NumSeq::TotientSteps -- count of repeated totients to reach 1


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


How many repeated applications of the totient function to reach 1, so from i=1

    0, 1, 2, 2, 3, 2, 3, 3, 3, 3, 4, 3, 4, ...

For example i=5 goes 5 -> 4 -> 2 -> 1 so value=3 steps.


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

$seq = Math::NumSeq::TotientSteps->new ()

Create and return a new sequence object.

Random Access

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

Return the count of totient(i) steps to get down to 1.

$value = $seq->pred($value)

Return true if $value occurs in the sequence, which simply means a count $value >= 0.


Math::NumSeq, Math::NumSeq::Totient, Math::NumSeq::TotientStepsSum, Math::NumSeq::DedekindPsiSteps



Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020, 2021 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 <>.