I was given in the exam to calculate $\phi(27)$, so I answered like this as I learned:
$\phi(27) = 3^2.3 = (3^2-3^1).(3^1-3^0) = 6-2 = 12$
I got shocked that the answer was supposed to be 18. Can someone explain how we get 18?
I was given in the exam to calculate $\phi(27)$, so I answered like this as I learned:
$\phi(27) = 3^2.3 = (3^2-3^1).(3^1-3^0) = 6-2 = 12$
I got shocked that the answer was supposed to be 18. Can someone explain how we get 18?
On
The formula you learned takes the prime factorization, and for that it is necessary for all prime factors to only appear once, with the exponent as big as possible! So:
$\phi(27) = \phi(3^{3}) = (3^{3}-3^{2}) = 18$
On
TYou have to count how many numbers from 1 .. 27 are not divisible by $3$, so $3=1.3, 6=2.3, 9=3.3, 12=4.3,\ldots, \frac{27}{3}.3$ dont count, so there remain $27 - \frac{27}{3}$ numbers coprime to $3$. But it is better to remember the formula $\phi(p^k) = p^k-p^{k-1}$ (but I prefer $=p^{k-1}(p-1)$).
For all $n\ge 2$ you have $$ \phi(n)=n\prod_{p\mid n}\left(1-\frac{1}{p}\right), $$ hence $\phi(3^3)=2\cdot 3^2$.