cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A032358 Number of iterations of phi(n) needed to reach 2.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 4, 2, 3, 3, 3, 3, 4, 3, 4, 3, 3, 3, 4, 3, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 5, 3, 4, 4, 4, 4, 5, 4, 4, 4, 5, 4, 5, 3, 5, 4, 4, 4, 5, 4, 5, 4, 4, 5, 5, 4, 5, 5, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5
Offset: 2

Views

Author

Ursula Gagelmann (gagelmann(AT)altavista.net)

Keywords

Comments

This sequence is additive (but not completely additive). [Charles R Greathouse IV, Oct 28 2011]
Shapiro asks for a proof that for every n > 1 there is a prime p such that a(p) = n. [Charles R Greathouse IV, Oct 28 2011]
This is A003434(n)-1 for n>1. - N. J. A. Sloane, Sep 02 2017

Crossrefs

Programs

  • Haskell
    a032358 = length . takeWhile (/= 2) . (iterate a000010)
    -- Reinhard Zumkeller, Oct 27 2011
    
  • Maple
    A032358 := proc(n)
        local a,phin ;
        if n <=2 then
            0;
        else
            phin := n ;
            a := 0 ;
            for a from 1 do
                phin := numtheory[phi](phin) ;
                if phin = 2 then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A032358(n),n=1..30) ; # R. J. Mathar, Aug 28 2015
  • Mathematica
    Table[Length[NestWhileList[EulerPhi[#]&,n,#>2&]]-1,{n,3,80}] (* Harvey P. Dale, May 01 2011 *)
  • PARI
    a(n)=my(t);while(n>2,n=eulerphi(n);t++);t \\ Charles R Greathouse IV, Oct 28 2011

Formula

a(n) = a(phi(n))+1, a(1) = -1. - Vladeta Jovovic, Apr 29 2003
a(n) = A003434(n) - 1 = A049108(n) - 2.
From Charles R Greathouse IV, Oct 28 2011: (Start)
Shapiro proves that log_3(n/2) <= a(n) < log_2(n) and also
a(mn) = a(m) + a(n) if either m or n is odd and a(mn) = a(m) + a(n) + 1 if m and n are even.
(End)

Extensions

a(2) = 0 added and offset adjusted, suggested by David W. Wilson