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.

Showing 1-3 of 3 results.

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

A053478 Sum of iterates when phi, A000010, is iterated until fixed point 1.

Original entry on oeis.org

1, 3, 6, 7, 12, 9, 16, 15, 18, 17, 28, 19, 32, 23, 30, 31, 48, 27, 46, 35, 40, 39, 62, 39, 60, 45, 54, 47, 76, 45, 76, 63, 68, 65, 74, 55, 92, 65, 78, 71, 112, 61, 104, 79, 84, 85, 132, 79, 110, 85, 114, 91, 144, 81, 126, 95, 112, 105, 164, 91, 152, 107, 118, 127, 144, 101
Offset: 1

Views

Author

Labos Elemer, Jan 14 2000

Keywords

Comments

For n = 2^w, the sum is 2^(w+1) - 1.

Examples

			If phi is applied repeatedly to n = 91, the iterates {91, 72, 24, 8, 4, 2, 1} are obtained. Their sum is a(91) = 91 + 72 + 24 + 8 + 4 + 2 + 1 = 202.
		

Crossrefs

Programs

  • Haskell
    a053478 = (+ 1) . sum . takeWhile (/= 1) . iterate a000010
    -- Reinhard Zumkeller, Oct 27 2011
    
  • Mathematica
    f[n_] := Plus @@ Drop[ FixedPointList[ EulerPhi, n], -1]; Table[ f[n], {n, 66}] (* Robert G. Wilson v, Dec 16 2004 *)
    f[1] := 1; f[n_] := n + f[EulerPhi[n]]; Table[f[n], {n, 66}] (* Carlos Eduardo Olivieri, May 26 2015 *)
  • PARI
    a(n)=my(s=n);while(n>1,s+=n=eulerphi(n)); s \\ Charles R Greathouse IV, Feb 21 2013

Formula

a(n) = n + a(phi(n)).
a(n) = A092693(n) + n. - Vladeta Jovovic, Jul 02 2004

A246700 Table read by rows: trajectories under iteration of Carmichael's lambda function (cf. A002322).

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 2, 1, 5, 4, 2, 1, 6, 2, 1, 7, 6, 2, 1, 8, 2, 1, 9, 6, 2, 1, 10, 4, 2, 1, 11, 10, 4, 2, 1, 12, 2, 1, 13, 12, 2, 1, 14, 6, 2, 1, 15, 4, 2, 1, 16, 4, 2, 1, 17, 16, 4, 2, 1, 18, 6, 2, 1, 19, 18, 6, 2, 1, 20, 4, 2, 1, 21, 6, 2, 1, 22, 10, 4, 2, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 02 2014

Keywords

Comments

Length of row n = A185816(n) + 1.

Examples

			.   |  1 | 1             | 13 | 13-12-2-1        | 25 | 25-20-4-2-1
.   |  2 | 2-1           | 14 | 14-6-2-1         | 26 | 26-12-2-1
.   |  3 | 3-2-1         | 15 | 15-4-2-1         | 27 | 27-18-6-2-1
.   |  4 | 4-2-1         | 16 | 16-4-2-1         | 28 | 28-6-2-1
.   |  5 | 5-4-2-1       | 17 | 17-16-4-2-1      | 29 | 29-28-6-2-1
.   |  6 | 6-2-1         | 18 | 18-6-2-1         | 30 | 30-4-2-1
.   |  7 | 7-6-2-1       | 19 | 19-18-6-2-1      | 31 | 31-30-4-2-1
.   |  8 | 8-2-1         | 20 | 20-4-2-1         | 32 | 32-8-2-1
.   |  9 | 9-6-2-1       | 21 | 21-6-2-1         | 33 | 33-10-4-2-1
.   | 10 | 10-4-2-1      | 22 | 22-10-4-2-1      | 34 | 34-16-4-2-1
.   | 11 | 11-10-4-2-1   | 23 | 23-22-10-4-2-1   | 35 | 35-12-2-1
.   | 12 | 12-2-1        | 24 | 24-2-1           | 36 | 36-6-2-1  .
		

Crossrefs

Programs

  • Haskell
    import Data.List (genericIndex)
    a246700 n k = genericIndex a246700_tabf (n - 1) !! (k-1)
    a246700_row n = genericIndex a246700_tabf (n - 1)
    a246700_tabf = [1] : f 2  where
       f x = (x : a246700_row (a002322 x)) : f (x + 1)
  • Mathematica
    Array[Most[FixedPointList[CarmichaelLambda, #]] &, 25] (* Paolo Xausa, Aug 17 2024 *)

Formula

T(n,1) = n and T(n,k+1) = A002322(T(n,k)), k = 1..A185816(n).
Showing 1-3 of 3 results.