TITLE: Order of $ U(n) $
QUESTION [4 upvotes]: Let $U(n)$ be group under multiplication modulo $n$. For $n=248$, find number of elements in $U (n)$. 
As I tried to do this problem. The number of required elements are $\phi(n) $. So to calculate $\phi(248) $ I first write $248$ as product of powers of primes.
So we have $248= 2^3\cdot 31$.
Since $\phi (n) = n (1- \frac{1}{p})(1-\frac{1}{q})$ , where $n=  p^iq^j$,
So $\phi (248) =248 (1-\frac{1}{2})(1-\frac{1}{31}) =120$.
But book says answer is $180$. What's going wrong?

REPLY [1 votes]: The answer indeed is $120$ if calculated by the established formulae. Since $248 =(2^3)\times31$. Then order of group $U(248)$ is
$$ \varphi \Big(\left(2^3\right)\times31\Big) = \varphi \left(2^3\right) \times \varphi (31) = 2^{3-1} \times (31-1) = 4 \times 30 = 120 $$
{"set_name": "stack_exchange", "score": 4, "question_id": 1114710}