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.

A049108 a(n) is the number of iterations of Euler phi function needed to reach 1 starting at n (n is counted).

Original entry on oeis.org

1, 2, 3, 3, 4, 3, 4, 4, 4, 4, 5, 4, 5, 4, 5, 5, 6, 4, 5, 5, 5, 5, 6, 5, 6, 5, 5, 5, 6, 5, 6, 6, 6, 6, 6, 5, 6, 5, 6, 6, 7, 5, 6, 6, 6, 6, 7, 6, 6, 6, 7, 6, 7, 5, 7, 6, 6, 6, 7, 6, 7, 6, 6, 7, 7, 6, 7, 7, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 7, 6, 7, 8, 6, 8, 6, 7, 7, 8, 6, 7, 7, 7, 7, 7, 7, 8, 6, 7, 7, 8, 7, 8, 7, 7
Offset: 1

Views

Author

Keywords

Examples

			If n=164 the trajectory is {164,80,32,16,8,4,2,1}. Its length is 8, thus a(164)=8.
		

Crossrefs

Cf. A000010, A007755. Equals A003434 + 1. Row lengths of A375478.

Programs

  • Maple
    A049108 := proc(n)
        local a, e;
        e := n ;
        a :=0 ;
        while e > 1 do
            a := a+1 ;
            e := numtheory[phi](e) ;
        end do:
        1+a;
    end proc:
    seq(A049108(n),n=1..60) ; # R. J. Mathar, Sep 08 2021
  • Mathematica
    f[n_] := Length[NestWhileList[ EulerPhi, n, # != 1 &]]; Array[f, 105] (* Robert G. Wilson v, Feb 07 2012 *)
  • PARI
    a(n)=my(t=1);while(n>1,t++;n=eulerphi(n));t \\ Charles R Greathouse IV, Feb 07 2012

Formula

By the definition of a(n) we have for n >= 2 the recursion a(n) = a(Phi(n)) + 1. - Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 20 2001
log_3 n << a(n) << log_2 n. - Charles R Greathouse IV, Feb 07 2012