5

I am trying to find the phi(18). Using an online calculator, it says it is 6 but im getting four.
The method I am using is by breaking 18 down into primes and then multiplying the phi(primes)

$$=\varphi (18)$$ $$=\varphi (3) \cdot \varphi(3) \cdot \varphi(2)$$ $$= 2 \cdot 2 \cdot 1$$ $$= 4$$

Krimson
  • 591
  • 7
    $\varphi(3^2) \ne \varphi(3) \cdot \varphi(3)$. –  Mar 04 '14 at 03:39
  • 2
    If $p$ is prime, then $\varphi(p^k)=p^k-p^{k-1}$. This is because there are $p^k$ numbers between $0$ and $p^k-1$. Of these, $p^{k-1}$ are multiples of $p$, and the rest are relatively prime to $p$. – André Nicolas Mar 04 '14 at 03:44
  • This question is similar: http://math.stackexchange.com/questions/79520/is-there-a-methodical-way-to-compute-eulers-phi-function – Martin Sleziak Mar 04 '14 at 09:10

4 Answers4

5

Remember that you need to determine the prime factorization of $18$. That is, $18 = 3^2 \cdot 2$. Since $18 = 3^2 \cdot 2$, we have

$$\begin{aligned} \varphi(18) = \varphi(3^2) \cdot \varphi(2) &= (3^2 - 3)(2 - 1) = 6 \end{aligned}$$

So in general, if $k = p_1^{n_1}p_2^{n_2}\cdots p_s^{n_s}$, then we have

$$\varphi(k) = \varphi(p_1^{n_1})\varphi(p_2^{n_2})\cdots \varphi(p_s^{n_s}) = (p_1^{n_1} - p_1^{n_1 - 1})(p_2^{n_2} - p_2^{n_2 - 1})\cdots (p_s^{n_s} - p_s^{n_s - 1})$$

Mr Mathster
  • 3,374
5

The phi function is multiplicative, but not completely multiplicative: Thus if $a, b$ are relatively prime, we have that

$$\varphi(ab) = \varphi(a) \varphi(b)$$

but this is not necessarily true if $a$ and $b$ have a common prime factor. In particular, it's true that

$$\varphi(18) = \varphi(2) \varphi(9)$$

but not $\varphi(2) \varphi(3)^2$.

2

Your multiplicative property is not necessarily true when the two numbers you're multiplying share a common factor. Here's the general formula: given $N = p_1^{q_1}p_2^{q_2}\cdots p_n^{q_n}$ (where $p_1, \ldots, p_n$ are distinct primes), we can find that $$ \phi(N) = N\left(1-\frac{1}{p_1}\right)\left(1-\frac{1}{p_2}\right)\cdots\left(1-\frac{1}{p_n}\right) $$

In the case of $18 = 2 \cdot 3^2$, this gives: $$ \phi(18) = 18\left(\frac{1}{2}\right)\left(\frac{2}{3}\right) = 6 $$ I leave the proof of this as an exercise (hint: consider (and enumerate) those numbers divisible by $p_1, p_2, \ldots, p_n$).

0

By definition, $\varphi(18)$ is the number of elements in the set $$\{n : 1\leq n \leq 17, \text{ with } \gcd(n,18)=1\}=\{1,5,7,11,13,17\}.$$ Thus, $\varphi(18)=6$. Similarly, $\varphi(9)$ is the number of elements in the set $$\{n : 1\leq n \leq 8, \text{ with } \gcd(n,9)=1\}=\{1,2,4,5,7,8\},$$ so $\varphi(9)=6$, and not $4$.