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-10 of 13 results. Next

A002202 Values taken by totient function phi(m) (A000010).

Original entry on oeis.org

1, 2, 4, 6, 8, 10, 12, 16, 18, 20, 22, 24, 28, 30, 32, 36, 40, 42, 44, 46, 48, 52, 54, 56, 58, 60, 64, 66, 70, 72, 78, 80, 82, 84, 88, 92, 96, 100, 102, 104, 106, 108, 110, 112, 116, 120, 126, 128, 130, 132, 136, 138, 140, 144, 148, 150, 156, 160, 162, 164, 166, 168, 172, 176
Offset: 1

Views

Author

Keywords

Comments

These are the numbers n such that for some m the multiplicative group mod m has order n.
Maier & Pomerance show that there are about x * exp(c (log log log x)^2)/log x members of this sequence up to x, with c = 0.81781465... (A234614); see the paper for details on making this precise. - Charles R Greathouse IV, Dec 28 2013
A264739(a(n)) = 1; a(n) occurs A058277(n) times in A007614. - Reinhard Zumkeller, Nov 26 2015
There are no odd numbers > 2 in the sequence and the even numbers that are not in the sequence are in A005277. - Bernard Schott, May 13 2020

References

  • J. W. L. Glaisher, Number-Divisor Tables. British Assoc. Math. Tables, Vol. 8, Camb. Univ. Press, 1940, p. 64.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A002110, A005277, A007614, A007617 (complement).
Cf. A083533 (first differences), A264739.
Cf. A006093 (a subsequence).

Programs

  • Haskell
    import Data.List.Ordered (insertSet)
    a002202 n = a002202_list !! (n-1)
    a002202_list = f [1..] (tail a002110_list) [] where
       f (x:xs) ps'@(p:ps) us
         | x < p = f xs ps' $ insertSet (a000010' x) us
         | otherwise = vs ++ f xs ps ws
         where (vs, ws) = span (<= a000010' x) us
    -- Reinhard Zumkeller, Nov 22 2015
  • Maple
    with(numtheory); t1 := [seq(nops(invphi(n)), n=1..300)]; t2 := []: for n from 1 to 300 do if t1[n] <> 0 then t2 := [op(t2), n]; fi; od: t2;
    # second Maple program:
    q:= n-> is(numtheory[invphi](n)<>[]):
    select(q, [$1..176])[];  # Alois P. Heinz, Nov 13 2024
  • Mathematica
    phiQ[m_] := Select[Range[m+1, 2m*Product[(1-1/(k*Log[k]))^(-1), {k, 2, DivisorSigma[0, m]}]], EulerPhi[#] == m &, 1 ] != {}; Select[Range[176], phiQ] (* Jean-François Alcover, May 23 2011, after Maxim Rytin *)
  • PARI
    lst(lim)=my(P=1,q,v);forprime(p=2,default(primelimit), if(eulerphi(P*=p)>=lim,q=p;break));v=vecsort(vector(P/q*lim\eulerphi(P/q),k,eulerphi(k)),,8);select(n->n<=lim,v) \\ Charles R Greathouse IV, Apr 16 2012
    
  • PARI
    select(istotient,vector(100,i,i)) \\ Charles R Greathouse IV, Dec 28 2012
    

A039770 Numbers k such that phi(k) is a perfect square.

Original entry on oeis.org

1, 2, 5, 8, 10, 12, 17, 32, 34, 37, 40, 48, 57, 60, 63, 74, 76, 85, 101, 108, 114, 125, 126, 128, 136, 160, 170, 185, 192, 197, 202, 204, 219, 240, 250, 257, 273, 285, 292, 296, 304, 315, 364, 370, 380, 394, 401, 432, 438, 444, 451, 456, 468, 489, 504, 505
Offset: 1

Views

Author

Keywords

Comments

A004171 is a subsequence because phi(2^(2k+1)) = (2^k)^2. - Enrique Pérez Herrero, Aug 25 2011
Subsequence of primes is A002496 since in this case phi(k^2+1) = k^2. - Bernard Schott, Mar 06 2023
Products of distinct terms of A002496 form a subsequence. - Chai Wah Wu, Aug 22 2025

Examples

			phi(34) = 16 = 4*4.
		

References

  • D. M. Burton, Elementary Number Theory, Allyn and Bacon Inc., Boston MA, 1976, p. 141.

Crossrefs

Cf. A000010, A007614. A062732 gives the squares. A306882 (squares not totient).

Programs

  • Maple
    with(numtheory); isA039770 := proc (n) return issqr(phi(n)) end proc; seq(`if`(isA039770(n), n, NULL), n = 1 .. 505); # Nathaniel Johnston, Oct 09 2013
  • Mathematica
    Select[ Range[ 600 ], IntegerQ[ Sqrt[ EulerPhi[ # ] ] ]& ]
  • PARI
    for(n=1, 120, if (issquare(eulerphi(n)), print1(n, ", ")))
    
  • Python
    from math import isqrt
    from sympy import totient as phi
    def ok(n): return isqrt(p:=phi(n))**2 == p
    print([k for k in range(1, 506) if ok(k)]) # Michael S. Branicky, Aug 17 2025

Formula

a(n) seems to be asymptotic to c*n^(3/2) with 1 < c < 1.3. - Benoit Cloitre, Sep 08 2002
Banks, Friedlander, Pomerance, and Shparlinski show that a(n) = O(n^1.421). - Charles R Greathouse IV, Aug 24 2009

A032447 Inverse function of phi( ).

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 8, 10, 12, 7, 9, 14, 18, 15, 16, 20, 24, 30, 11, 22, 13, 21, 26, 28, 36, 42, 17, 32, 34, 40, 48, 60, 19, 27, 38, 54, 25, 33, 44, 50, 66, 23, 46, 35, 39, 45, 52, 56, 70, 72, 78, 84, 90, 29, 58, 31, 62, 51, 64, 68, 80, 96, 102, 120, 37, 57, 63, 74, 76, 108, 114, 126
Offset: 1

Views

Author

Ursula Gagelmann (gagelmann(AT)altavista.net)

Keywords

Comments

Arrange integers in order of increasing phi value; the phi values themselves form A007614.
Inverse of sequence A064275 considered as a permutation of the positive integers. - Howard A. Landman, Sep 25 2001
In the array shown in the example section row no. n gives exactly the N values for which the cyclotomic polynomials cyclotomic(N,x) have degree A002202(n). - Wolfdieter Lang, Feb 19 2012.

Examples

			phi(1)=phi(2)=1, phi(3)=phi(4)=phi(6)=2, phi(5)=phi(8)=...=4, ...
From _Wolfdieter Lang_, Feb 19 2012: (Start)
Read as array a(n,m) with row length l(n):=A058277(v(n)) with v(n):= A002202(n), n>=1. a(n,m) = m-th element of the set {m from positive integers: phi(m)=v(n)} when read as an increasingly ordered list.
  l(n): 2, 3, 4, 4, 5, 2, 6, 6, 4, 5, ...
   n, v(n)\m 1  2  3  4  5  6  7  8  9  10 11  12  13  14
   1,  1:    1  2
   2,  2:    3  4  6
   3,  4:    5  8 10 12
   4,  6:    7  9 14 18
   5,  8:   15 16 20 24 30
   6, 10:   11 22
   7, 12:   13 21 26 28 36 42
   8, 16:   17 32 34 40 48 60
   9, 18:   19 27 38 54
  10, 20:   25 33 44 50 66
  ...
Row no. n=4: The cyclotomic polynomials cyclotomic(N,x) with values N = 7,9,14, and 18 have degree 6, and only these.
(End)
		

References

  • Sivaramakrishnan, The many facets of Euler's Totient, I. Nieuw Arch. Wisk. 4 (1986), 175-190.

Crossrefs

Programs

  • Haskell
    import Data.List.Ordered (insertBag)
    a032447 n = a032447_list !! (n-1)
    a032447_list = f [1..] a002110_list [] where
       f xs'@(x:xs) ps'@(p:ps) us
         | x < p = f xs ps' $ insertBag (a000010' x, x) us
         | otherwise = map snd vs ++ f xs' ps ws
         where (vs, ws) = span ((<= a000010' x) . fst) us
    -- Reinhard Zumkeller, Nov 22 2015
    
  • Mathematica
    Needs["CNT`"]; Flatten[Table[PhiInverse[n], {n, 40}]] (* T. D. Noe, Oct 15 2012 *)
    Take[Values@ PositionIndex@ Array[EulerPhi, 10^3], 15] // Flatten (* Michael De Vlieger, Dec 29 2017 *)
    SortBy[Table[{n,EulerPhi[n]},{n,150}],Last][[All,1]] (* Harvey P. Dale, Oct 11 2019 *)
  • PARI
    M = 9660; /* choose a term of A036913 */
    v = vector(M, n, [eulerphi(n),n] );
    v = vecsort(v, (x, y)-> if( x[1]-y[1]!=0, sign(x[1]-y[1]), sign(x[2]-y[2]) ) );
    P=eulerphi(M);
    v = select( x->(x[1]<=P), v );
    /* A007614 = vector(#v,n, v[n][1] ) */
    A032447 = vector(#v,n, v[n][2] )
    /* for (n=1,#v, print(n," ", A032447[n]) ); */ /* b-file */
    /* Joerg Arndt, Oct 06 2012 */
    
  • Perl
    use ntheory ":all"; my($n,$k,$i,@v)=(10000,1,0); push @v,inverse_totient($k++) while @v<$n; $#v=$n-1; say ++$i," $" for @v; # _Dana Jacobsen, Mar 04 2019

Extensions

Example corrected, more terms and program from Olivier Gérard, Feb 1999

A058277 Number of values of k such that phi(k) = n, where n runs through the values (A002202) taken by phi.

Original entry on oeis.org

2, 3, 4, 4, 5, 2, 6, 6, 4, 5, 2, 10, 2, 2, 7, 8, 9, 4, 3, 2, 11, 2, 2, 3, 2, 9, 8, 2, 2, 17, 2, 10, 2, 6, 6, 3, 17, 4, 2, 3, 2, 9, 2, 6, 3, 17, 2, 9, 2, 7, 2, 2, 3, 21, 2, 2, 7, 12, 4, 3, 2, 12, 2, 8, 2, 10, 4, 2, 21, 2, 2, 8, 3, 4, 2, 3, 19, 5, 2, 8, 2, 2, 6, 2, 31, 2, 9, 10
Offset: 1

Views

Author

Claude Lenormand (claude.lenormand(AT)free.fr), Jan 05 2001

Keywords

Comments

Carmichael (1922) conjectured that the number 1 never appears in this sequence. Sierpiński conjectured and Ford (1998) proved that all integers greater than 1 occur in the sequence. Erdős (1958) proved that if s >= 1 appears in the sequence then it appears infinitely often. - Nick Hobson, Nov 04 2006
A002202(n) occurs a(n) times in A007614. - Reinhard Zumkeller, Nov 22 2015

References

  • Édouard Lucas, Théorie des Nombres, Blanchard 1958.

Crossrefs

The nonzero terms of A014197.
Cf. A006511 (largest k for which A000010(k) = A002202(n)).

Programs

  • Haskell
    import Data.List (group)
    a058277 n = a058277_list !! (n-1)
    a058277_list = map length $ group a007614_list
    -- Reinhard Zumkeller, Nov 22 2015
    
  • Mathematica
    max = 300; inversePhi[?OddQ] = {}; inversePhi[1] = {1, 2}; inversePhi[m] := Module[{p, nmax, n, nn}, p = Select[Divisors[m] + 1, PrimeQ]; nmax = m * Times @@ (p/(p-1)); n = m; nn = Reap[While[n <= nmax, If[EulerPhi[n] == m, Sow[n]]; n++]] // Last; If[nn == {}, {}, First[nn] ] ]; Reap[For[n = 1, n <= max, n = If[n == 1, 2, n+2], nn = inversePhi[n] ; If[nn != {} , Sow[nn // Length] ] ] ] // Last // First (* Jean-François Alcover, Nov 21 2013 *)
  • PARI
    lista(nmax) = {my(m); for(n = 1, nmax, m = invphiNum(n); if(m > 0, print1(m, ", ")));} \\ Amiram Eldar, Nov 15 2024 using Max Alekseyev's invphi.gp

Extensions

More terms from Nick Hobson, Nov 04 2006

A039771 Numbers k such that phi(k) is a perfect cube.

Original entry on oeis.org

1, 2, 15, 16, 20, 24, 30, 85, 128, 136, 160, 170, 192, 204, 240, 247, 259, 327, 333, 351, 399, 405, 436, 494, 518, 532, 648, 654, 666, 684, 702, 756, 771, 798, 810, 1024, 1028, 1088, 1111, 1255, 1280, 1360, 1375, 1536, 1542, 1632, 1843, 1853, 1875, 1920, 2008
Offset: 1

Views

Author

Keywords

Comments

a(n) is prime only for a(2)=2, for other cases: eulerphi(p) = p-1 = n^3, and p = 1 + n^3 = (n+1)(n^2-n+1), so p cannot be a prime. - Enrique Pérez Herrero, Aug 29 2010
A013730 is a subsequence. - Enrique Pérez Herrero, Aug 29 2010

Examples

			phi(247) = 216 = 6*6*6.
		

Crossrefs

Programs

  • Maple
    q:= n-> (c-> iroot(c, 3)^3=c)(numtheory[phi](n)):
    select(q, [$1..2200])[];  # Alois P. Heinz, Sep 01 2025
  • Mathematica
    Select[ Range[ 2000 ], IntegerQ[ Power[ EulerPhi[ # ], 1/3 ] ]& ]
  • PARI
    for(n=1,1e4,if(ispower(eulerphi(n),3),print1(n", "))) \\ Charles R Greathouse IV, Jul 31 2011

A039698 Numbers k such that phi(k) + 1 is prime.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 19, 21, 22, 23, 26, 27, 28, 29, 31, 32, 34, 36, 37, 38, 40, 41, 42, 43, 46, 47, 48, 49, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 67, 71, 73, 74, 75, 76, 77, 79, 82, 83, 86, 88, 89, 91, 93, 94, 95, 97, 98, 99, 100, 101, 103
Offset: 1

Views

Author

Keywords

Comments

Positive integers k for which values of A039649(k) are primes. - Vladimir Shevelev, May 10 2008
For every prime p, the numbers p and 2p are terms of this sequence. - Vladimir Shevelev, May 10 2008
Union of A000040 and A066071. - Ray Chandler, May 26 2008

Examples

			phi(10)+1 = 4+1 = 5, a prime number, so 10 is a term.
		

Crossrefs

Cf. A039689 (complement), A296079 (characteristic function).

Programs

  • Magma
    [n: n in [1..200] | IsPrime(EulerPhi(n)+1)]; // Vincenzo Librandi, Aug 13 2013
  • Mathematica
    Select[Range[300], PrimeQ[EulerPhi[#] + 1]&] (* Vincenzo Librandi, Aug 13 2013 *)

Extensions

Edited by N. J. A. Sloane, May 21 2008 at the suggestion of R. J. Mathar

A085713 Consider numbers k such that phi(x) = k has exactly 3 solutions and they are (3*p, 4*p, 6*p) where p is 1 or a prime. Sequence gives values of p.

Original entry on oeis.org

1, 23, 29, 47, 53, 59, 71, 83, 103, 107, 131, 149, 167, 173, 179, 191, 197, 223, 227, 239, 263, 269, 283, 293, 311, 317, 347, 359, 373, 383, 389, 419, 431, 443, 467, 479, 491, 503, 509, 557, 563, 569, 587, 599, 643, 647, 653, 659, 677, 683, 709, 719
Offset: 1

Views

Author

Alford Arnold, Jul 19 2003

Keywords

Comments

Prime numbers in this sequence are called prime replicators of 2, by Stolarski and Greenbaum, (3, 4, 6) being the solutions of phi(x)=2. - Michel Marcus, Oct 20 2012
Prime numbers in this sequence when multiplied by 2 equal k + 2. For example, 83 * 2 = 164 + 2. - Torlach Rush, Jun 16 2018

Examples

			83 is a term because the three solutions (249,332,498) to phi(x) = 164 can be written as (3*83, 4*83, 6*83).
		

Crossrefs

Programs

  • Haskell
    import Data.List.Ordered (insertBag)
    import Data.List (groupBy); import Data.Function (on)
    a085713 n = a085713_list !! (n-1)
    a085713_list = 1 : r yx3ss where
       r (ps:pss) | a010051' cd == 1 &&
                    map (flip div cd) ps == [3, 4, 6] = cd : r pss
                  | otherwise = r pss  where cd = foldl1 gcd ps
       yx3ss = filter ((== 3) . length) $
           map (map snd) $ groupBy ((==) `on` fst) $
           f [1..] a002110_list []
           where f is'@(i:is) ps'@(p:ps) yxs
                  | i < p = f is ps' $ insertBag (a000010' i, i) yxs
                  | otherwise = yxs' ++ f is' ps yxs''
                  where (yxs', yxs'') = span ((<= a000010' i) . fst) yxs
    -- Reinhard Zumkeller, Nov 25 2015
    
  • Mathematica
    t = Table[ EulerPhi[n], {n, 1, 5000}]; u = Union[ Select[t, Count[t, # ] == 3 &]]; a = {}; Do[k = 1; While[ EulerPhi[3k] != u[[n]], k++ ]; AppendTo[a, k], {n, 1, 60}]; Sort[a]
  • PARI
    is(p) = if(p > 1 && !isprime(p), 0, invphi(eulerphi(3*p)) == [3*p, 4*p, 6*p]); \\ Amiram Eldar, Nov 19 2024, using Max Alekseyev's invphi.gp

Extensions

Edited and extended by Robert G. Wilson v, Jul 19 2003
Nonprimes 343=7^3 and 361=19^2 deleted by Reinhard Zumkeller, Nov 25 2015

A035113 Numbers != 2 (mod 4) listed in order of increasing totient function phi (A000010).

Original entry on oeis.org

1, 3, 4, 5, 8, 12, 7, 9, 15, 16, 20, 24, 11, 13, 21, 28, 36, 17, 32, 40, 48, 60, 19, 27, 25, 33, 44, 23, 35, 39, 45, 52, 56, 72, 84, 29, 31, 51, 64, 68, 80, 96, 120, 37, 57, 63, 76, 108, 41, 55, 75, 88, 100, 132, 43, 49, 69, 92, 47, 65, 104, 105, 112, 140, 144
Offset: 1

Views

Author

Keywords

Examples

			phi(1)=1, phi(3)=2, phi(4)=2, phi(5)=4, ...
		

Crossrefs

Programs

  • Python
    from sympy import totient as A000010
    def lov(n): return sorted([[A000010(n), n] for n in range(1,n) if n%4 != 2])
    print([x[1] for x in lov(200)][:100]) # Dumitru Damian, Feb 01 2022

Extensions

More terms from James Sellers
a(43) onward corrected by Sean A. Irvine, Sep 26 2020

A035114 Values of phi(n) corresponding to A035113.

Original entry on oeis.org

1, 2, 2, 4, 4, 4, 6, 6, 8, 8, 8, 8, 10, 12, 12, 12, 12, 16, 16, 16, 16, 16, 18, 18, 20, 20, 20, 22, 24, 24, 24, 24, 24, 24, 24, 28, 30, 32, 32, 32, 32, 32, 32, 36, 36, 36, 36, 36, 40, 40, 40, 40, 40, 40, 42, 42, 44, 44, 46, 48, 48, 48, 48, 48, 48, 48, 48, 48
Offset: 1

Views

Author

Keywords

Examples

			phi(1)=1, phi(3)=2, phi(4)=2, phi(5)=4, ...
		

Crossrefs

Programs

  • Python
    from sympy import totient as A000010
    def lov(n): return sorted([[A000010(n), n] for n in range(1,n) if n%4 != 2])
    print([x[0] for x in lov(200)][:100]) # Dumitru Damian, Feb 03 2022

Formula

a(n) = A000010(A035113(n)). - Michel Marcus, Feb 07 2022

Extensions

More terms from James Sellers
a(43) onward corrected by Sean A. Irvine, Sep 26 2020

A039689 Numbers k such that phi(k) + 1 is not a prime.

Original entry on oeis.org

15, 16, 20, 24, 25, 30, 33, 35, 39, 44, 45, 50, 51, 52, 56, 64, 65, 66, 68, 69, 70, 72, 78, 80, 81, 84, 85, 87, 90, 92, 96, 102, 104, 105, 112, 116, 120, 121, 123, 128, 129, 130, 136, 138, 140, 141, 143, 144, 147, 155, 156, 159, 160, 161, 162, 164, 165, 168, 170
Offset: 1

Views

Author

Keywords

Examples

			phi(20)+1 = 8+1 = 9 is not prime.
		

Crossrefs

Cf. A000010, A007614, A039649, A039698 (complement).
Positions of zeros in A296079.
Cf. also A263029.

Programs

  • Mathematica
    Select[Range[200],!PrimeQ[EulerPhi[#]+1]&] (* Harvey P. Dale, Aug 31 2018 *)
  • PARI
    isok(k) = !isprime(eulerphi(k)+1); \\ Michel Marcus, Jun 28 2021

Extensions

Name edited by Antti Karttunen, Dec 05 2017
Showing 1-10 of 13 results. Next