Minimum Totient Quotient

Let ϕ ( n ) \phi(n) be the Euler phi function. If 1 n 1000 1 \leq n \leq 1000 , what is the smallest integer value of n n that minimizes ϕ ( n ) n ? \frac{\phi(n)}{n}?

You may choose to read Euler's theorem .


Details and Assumptions:

  • You are asked to find the value of n n , not ϕ ( n ) n \frac {\phi(n) } {n} .
  • ϕ ( 1 ) = 1 \phi(1) = 1 by definition.


The answer is 210.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

14 solutions

Philip Sun
May 20, 2014

Given an integer N = p 1 q 1 p 2 q 2 . . . p n q n N=p_1^{q_1}p_2^{q_2}...p_n^{q_n} , ϕ N = N ( 1 1 p 1 ) ( 1 1 p 2 ) . . . ( 1 1 p n ) \phi N=N(1-\frac{1}{p_1})(1-\frac{1}{p_2})...(1-\frac{1}{p_n}) . Thus, ϕ N N = ( 1 1 p 1 ) ( 1 1 p 2 ) . . . ( 1 1 p n ) \frac{\phi N}{N}=(1-\frac{1}{p_1})(1-\frac{1}{p_2})...(1-\frac{1}{p_n}) . Each of these expressions in the parentheses is less than one, so the more of these terms there are, the smaller their product will be. In addition, ( 1 1 p i ) (1-\frac{1}{p_i}) will be closest to zero when p i p_i is closest to one, so we want small prime factors. A number composed of small primes will have each term be smaller and allow more terms to fit before the number exceeds one thousand. Thus, we start with the first prime, two, and repeatedly multiply until we find the greatest number that is still under one thousand. This number turns out to be 2 × 3 × 5 × 7 = 210 2\times3\times5\times7=210 , which has a totient quotient of 8 35 \frac{8}{35} . 210 is also the smallest number that can get such a totient quotient, because it has exactly one of each prime factor. Any multiples of the number less than one thousand would be larger, but still have the same totient quotient because they still only have those four prime factors. Thus, the answer is 210.

The tricky part of this problem is to clearly explain how to arrive at the minimum. There are several ideas involved - 1) Having prime factors, 2) Having small prime factors, 3) Having numerous prime factors, 4) Having distinct prime factors.

When applied in the correct order, the proof flows directly and doesn't require consideration of numerous cases / separate arguments.

Calvin Lin Staff - 7 years ago

Log in to reply

guessed this right

a b - 1 year, 4 months ago

Damn!!i foolishly entered the highest one...840...and got it wrong 😢😢

Istiak Reza - 4 years, 7 months ago

31^2 = 961 gives 1/31 < 8/25

Lee Chun - 3 years, 2 months ago

Log in to reply

Ø(961)/961=1-1/31=30/31

Lu Ca - 2 years, 8 months ago
Gabriel Wong
May 20, 2014

Let f ( n ) f(n) be the euler phi function for n to save on formatting. If a and b are coprime, f ( a ) f ( b ) = f ( a b ) f(a)f(b) = f(ab) . Also, note that f ( p k ) / ( p k ) = ( p 1 ) / p f(p^k)/(p^k) = (p-1)/p for all prime p p , and all positive integers k k .

Thus if n is minimal s.t. f ( n ) / n f(n)/n is minimal, if we factor it into ( p 1 q 1 ) ( p 2 q 2 ) . . . ( p m q m ) (p_1^{q_1})*(p_2^{q_2})...*(p_m^{q_m}) , by the previous observation all q i q_i are 1. Thus n = p 1 p 2 . . . p m n = p_1*p_2*...*p_m (these primes are ordered p 1 < p 2 < . . . < p m p_1 < p_2 < ... < p_m ). Note that ( p 1 ) / p (p-1)/p is strictly increasing as p p increases and is always less than 1; the former observation implies that there exists no prime q between p k p_k and p k + 1 p_{k+1} s.t. q q is not in p i p_i ; while the second observation implies that 1000 < p 1 p 2 . . . p m q 1000 < p1*p2*...*pm*q for any prime q > p m q > pm since the value of f ( n q ) / ( n q ) f(n*q)/(n*q) is smaller. Thus the answer is just 2 3 5 7 = 210 2*3*5*7 = 210 .

While most knew that the answer must come from the product of several primes, they had difficulty justifying the following:

  1. We want distinct prime factors, which follows because f ( p k ) / ( p k ) = ( p 1 ) / p f(p^k)/(p^k) = (p-1)/p .

  2. We want as many prime factors as possible, which follows since ( p 1 ) p < 1 (p-1)p < 1 .

  3. We want all the small prime factors first, which follows since ( p 1 ) / p (p-1)/p is strictly increasing.

It is easiest to do so in this order.

Other errors:

  1. Be careful of your notation n = p 1 q 1 × p 2 q 2 × n = p_1^{q_1} \times p_2^{q_2} \times \ldots is very different from n = p 1 q 1 + p 2 q 2 + n = p_1^{q_1} + p_2^{q_2} + \ldots .

  2. n n almost certainly doesn't have n n prime factors from p 1 p_1 to p n p_n .

Calvin Lin Staff - 7 years ago
Calvin Lin Staff
May 13, 2014

We factorize n n such that: n = p 1 q 1 p 2 q 2 p k q k n = p_1^{q_1}p_2^{q_2}\ldots p_k^{q_k} , where p 1 , p 2 , , p k p_1, p_2, \ldots, p_k are distinct prime factors of n n and q 1 , q 2 , , q k q_1, q_2, \ldots, q_k are positive integers. So, we have ϕ ( n ) = n ( p 1 1 p 1 ) ( p 2 1 p 2 ) ( p n 1 p k ) \phi(n) = n\cdot \left(\frac{p_1-1}{p_1}\right)\left(\frac{p_2-1}{p_2}\right)\ldots \left(\frac{p_n-1}{p_k}\right) . Thus ϕ ( n ) n = ( p 1 1 p 1 ) ( p 2 1 p 2 ) ( p k 1 p k ) \frac{\phi(n)}{n} = \left(\frac{p_1-1}{p_1}\right)\left(\frac{p_2-1}{p_2}\right)\ldots \left(\frac{p_k-1}{p_k}\right) . This implies that the value of ϕ ( n ) n \frac{\phi(n)}{n} is not dependent on the exponents of the prime factorization of n n , hence to minimize it we set q 1 = q 2 = = q k = 1 q_1 = q_2 = \ldots = q_k = 1 .

We have r 1 r < s 1 s 1 s < 1 r r < s \frac{r-1}{r} < \frac{s-1}{s} \Leftrightarrow \frac {1}{s} < \frac {1}{r} \Leftrightarrow r < s . Thus this product is minimized by taking smallest k k prime factors, and as many of them as possible. Hence we have n = 2 1 3 1 5 1 7 1 = 210 n = 2^1\cdot 3^1 \cdot 5^1 \cdot 7^1 = 210 as the smallest possible value.

Caleb He
May 20, 2014

Euler's Phi Function is defined as followed: If n is a positive integer, phi(n) is the number of integers k, 1<=k<=n-1, such that (n, k)=1. The formula for phi(n) where n=p 1^e 1 + p 2^e^2 + . . . + p m^e m is (1-1/p 1) (1-1/p_2) . . . (1-1/p_m) n, where each p i are distinct and prime. Now, we see that phi(n)/n=(1-1/p 1) (1-1/p_2) . . .*(1-1/p m). To minimize this, we wish to have as many prime factors as possible in n to make the product smaller and smaller. Also, the factor (1-1/p i) is minimized when p_i is smaller. Choosing the most possible amount of the first consecutive primes (i.e. the smallest primes) for n while keeping n less than 1000, we find that n=2x3x5x7=210, our desired answer.

Lester Ilao
May 20, 2014

210= 2\times3 \times 5 \times 7 you might conjecture that for 1 \leq n \leq m , the value minimizing \frac {phi( n )}{ n } is the smallest primorial less than or equal to m .

This conjecture is in fact true and easy to prove if you know that \phi( n ) is multiplicative and when p is prime.

Doesn't explain why it's true.

Calvin Lin Staff - 7 years ago
Tristan Pollner
May 20, 2014

We can rewrite ϕ ( n ) n \frac{\phi(n)}{n} as ( p 1 1 ) p 1 ( p 2 1 ) p 2 . . . ( p k 1 ) p k \frac{(p_1-1)}{p_1}\frac{(p_2-1)}{p_2}...\frac{(p_k-1)}{p_k} by the definition of the phi function, where p i p_i are the prime factors of n n .

Therefore, to minimize this, we just want to maximize the number of prime factors and put them as small as possible.

The maximum number of prime factors we can have is 4 if we choose 2, 3, 5, 7 so our number is 210 210 .

Doesn't explain minimal of n.

Calvin Lin Staff - 7 years ago
Matt Babbitt
May 20, 2014

Note that if n = p 1 e 1 p i e i n=p_1^{e_1}\cdots p_i^{e_i} is the prime factorization of n n , then ϕ ( n ) = n p 1 1 p 1 p i 1 p i \phi(n)=n\cdot \frac{p_1-1}{p_1}\cdots\frac{p_i-1}{p_i} . So if p n p\mid n , then ϕ ( p n ) p n = ϕ ( n ) n \dfrac{\phi(pn)}{pn}=\dfrac{\phi(n)}{n} . Hence the minimal n n is a product of distinct primes. Also note that x 1 x \frac{x-1}{x} is a strictly increasing function, so we wish for the prime factors of n n to be as small as possible. Some calculation yields n = 2 3 5 7 = 210 n=2\cdot 3\cdot 5\cdot 7=\boxed{210} .

I'm not good at number theory, therefore python will save me xD

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def hcf(arg1, arg2):
    i = 1
    k = 1
    while i <= arg1:
        if ((arg1%i == 0) & (arg2%i == 0)):
            k = i
        i += 1
    return k

def totient(num):
    i=1
    s=0
    while i <= num:
        if hcf(num,i) == 1:
            s += 1
        i += 1
    return s

min=1
f=1
p=1
while p<=1000:
    if totient(p)/p < min:
        min = totient(p)/p
        f=p
    p += 1

print(f)

The code takes some time to show the output though.

Arturo Presa
Dec 11, 2016

A very important idea here is that the number of different prime factors of a number less than or equal to 1000 is 4. If a natural number n n less than or equal to 1000 had, for example, 5 different prime factors, then assuming that the prime factors are p 1 , p 2 , p 3 , p 4 , p 5 , p_1, p_2, p_3, p_4, p_5, given in an increasing order, we will have that p 1 2 , p_1 \geq 2, p 2 3 , p_2\geq 3, p 3 5 , p_3\geq 5, p 4 7 , p_4\geq 7, p 5 11. p_5\geq 11. Therefore, n p 1 p 2 p 3 p 4 p 5 2 3 5 7 11 = 2310 , n\geq p_1 p_2 p_3 p_4 p_5\geq 2*3*5*7*11=2310, that is contradiction. Now, we can find the minimum value of ϕ ( n ) n \frac{\phi(n)}{n} assuming that an expression of the form ( 1 1 / x ) (1-1/x) is increasing for x > 0 , x>0, and, therefore, we can make the following conclusions. When n n has only one prime factor the minimum value must be ( 1 1 / 2 ) = 1 / 2. (1-1/2)=1/2. If n n has two prime factors, then the minimum would be ( 1 1 / 2 ) ( 1 1 / 3 ) = 1 / 3. (1-1/2)(1-1/3)=1/3. For the case when n n has three or four factors, the minimum values would be ( 1 1 / 2 ) ( 1 1 / 3 ) ( 1 1 / 5 ) = 4 / 15 (1-1/2)(1-1/3)(1-1/5)=4/15 or ( 1 1 / 2 ) ( 1 1 / 3 ) ( 1 1 / 5 ) ( 1 1 / 7 ) = 8 / 35 , (1-1/2)(1-1/3)(1-1/5)(1-1/7)=8/35, respectively. Out of these four numbers the smallest is 8 / 35. 8/35. So the minimum is attained at a number n n with prime factors 2 , 3 , 5 , 7 , 2, 3, 5, 7, and then the smallest possible value of n n is 2 3 5 7 = 210. 2*3*5*7=210.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from math import sqrt

def eratosthenes_sieve(n):
    A = [True for i in range(0,n+1)]

    limit = int(sqrt(n))

    for i in range(2, limit+1):
        if A[i] == True:
            j = i*i
            while j <= n:
                A[j] = False
                j += i

    B = [ i for i in range(2,n+1) if A[i] == True ]

    return B

def totient(n):
    ans = n

    for num in dafuq_list:
        if n%num == 0:
            ans *= (num-1)

        if num > n:
            break

    for num in dafuq_list:
        if n%num == 0:
            ans /= num

        if num > n:
            break

    return ans    

dafuq_list = eratosthenes_sieve(1000)

list1 = []
for i in range(1,1001):
    spam = totient(i) / float(i)
    list1.append(spam)

y = reduce( lambda x,y: x if (x < y) else y, list1 )
print list1.index(y)+1
# index will be printed so I added 1 into it

Emrul Kais
Dec 20, 2014

for n = 210 , 420 , 630, ... given ratio is minimized . Among them , 210 is the smallest n :)

Anderson Silva
May 20, 2014

If n = a 1 b 1 a 2 b 2 a n b n n=a_1^{b_1} a_2^{b_2} \ldots a_n^{b_n} , where a 1 a 2 a n a_1 a_2 \ldots a_n are primes and b 1 b 2 b n b_1 b_2 \ldots b_n are non-negative integers, ϕ ( n ) = ( a 1 1 ) a 1 b 1 1 ( a 2 1 ) a 2 b 2 1 ( a n 1 ) a n b n 1 \phi(n)=(a_1-1)a_1^{b_1-1}(a_2-1)a_2^{b_2-1}\ldots (a_n-1)a_n ^{b_n-1} . Hence, ϕ ( n ) n = ( a 1 1 ) a 1 ( a 2 1 ) a 2 ( a n 1 ) a n \frac{\phi(n)}{n}=\frac{(a_1-1)}{a_1} \frac{(a_2-1)}{a_2}\ldots \frac{(a_n-1)}{a_n} . This implies that ϕ ( n ) n \frac{\phi(n)}{n} decreases as the number of prime divisors increases, and is the same regardless of the power of the prime factors. As such, we want to get as many primes as possible: 2 × 3 × 5 × 7 = 210 2 \times 3 \times 5 \times 7=210 while 2 × 3 × 5 × 7 × 11 > 1000 2 \times 3 \times 5 \times 7 \times 11>1000 . Hence, n = 210 n=210 .

Athul Nambolan
May 20, 2014

ϕ ( n ) n \frac {\phi(n)}{n} = n × i = 2 n p 1 p n \frac {n \times \displaystyle\sum_{i=2}^n \frac {p-1}{p}}{n}

= ( p 1 p ) ( p 2 1 p 2 ) . . . . . ( p n 1 p n ) = (\frac {p-1}{p} )(\frac{p{2} -1} {p{2}}).....(\frac{pn-1}{pn})

Here n is given to be least integer less than 1000, therefore we conclude each prime p divide n only one once

Second n = p × ( p 2 ) . . . . ( p n ) n = p\times(p2)....(pn) here n less than 1000

as p occurs only once therefore n = ( 2 ) ( 3 ) ( 5 ) ( 7 ) = 210 n=(2)(3)(5)(7) = 210 as if the next prime 11 is multiplied, n n exceeds 1000. n = 210 n=210

Here n is given to be least integer less than 1000, therefore we conclude each prime p divide n only one once

Notation errors, pn primes that divide n?

Calvin Lin Staff - 7 years ago
Gabriel Singhal
May 20, 2014

[Student revision]

First , let us write n as n = p a × q b + n=p^a\times q^b+\ldots , where p,q… are prime numbers. The formula for calculating ϕ ( n ) \phi(n) is ϕ ( n ) = n ( 1 1 / p ) ( 1 1 / q ) + \phi(n)=n(1-1/p)(1-1/q)+\ldots .Putting both these values in our fraction , we get ϕ ( n ) / n = ( ( p 1 ) / p × ( q 1 ) / q + ( l d o t s \phi(n)/n=((p-1)/p\times (q-1)/q+(ldots . Rearranging the expression, (p-1)(q-1)+ ldots/)\(p^{a+1}\times q(b+1) + \ldots . Since we want the minimum the value of n less than 1000, we want the value of the numerator to be least and the denominator to be maximum. For the numerator to be minimum, all p,q,..., should be as small as possible, and as they are prime numbers, the should be 2,3,.... Now for the denominator to be maximum, let the values of a,b,... be 1. Now looking at prime numbers, the product of 2,3,5,7,11, exceeds 1000, therefore we will have to consider of the first four only which comes to be 210.

Notation errors

Doesn't explain "minimize numerator, maximize denominator".

Calvin Lin Staff - 7 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...