2
$\begingroup$

I know that $\varphi(p)=p-1$, so it rules out the primes. I then tried to consider all powers of primes. It then turn out that only $2^2=4$ works

If $$ n = pq\\ \varphi(n)=(p-1)(q-1)=pq-p-q+q=n-p-q+1\\ \rightarrow 1-p-q=-2 $$ which would't work since we want n to be positive I'm pretty stuck from here. I also tried to reason that $\varphi(n)=n\prod (1-\frac{1}{p_i})$ but couldn't get anywhere.

Thanks in advance for any help.

  • 0
    Had a mistype, sorry about that. it should've been $\phi(n)=n-2$ @Winther2017-02-07
  • 0
    @casualprogrammer Don't you mean $\phi(n)$?2017-02-07
  • 0
    @casualprogrammer Can you do the case when $n$ is even? I've answered for the case when $n$ is odd.2017-02-07
  • 0
    @S.C.B. yes thank you for noticing2017-02-07
  • 0
    Ah, that makes more sense given what you have written since $\phi(2n) = n-2$ holds for all $n$ on the form $n = 2p$ with $p$ prime.2017-02-07

4 Answers 4

5

Assume $n$ has more than one prime factor. Let these prime factors be $p$, $q$. Since $p$ and $q$ and $n$ are not coprime with $n$, but $\phi(n)$ counts the number of numbers coprime to $n$, this implies $n-2=\phi(n)\le n-3$. Contradiction.

Thus, $n$ has one prime factor. So $n=p^{e}$ so some $p$ prime and $e$ natural. So $$p^{e}-2=n-2=\phi(n)=\phi(p^{e})=p^{e}-p^{e-1}$$ So $p^{e-1}=2$. By the Fundamental Theorem of Arithmetic, $p=2, e=2$,. So the only solution is $n=4$. We are done.

  • 0
    @casualprogrammer So assume there exists a prime factor larger than $2$. Then we have that $n-2$2$. – 2017-02-07
  • 0
    ahh i see! thank you so much! @S.C.B.2017-02-07
  • 0
    @casualprogrammer Wait, there was an error.2017-02-07
  • 0
    @casualprogrammer Do you understand?2017-02-07
2
  • $n$ is even, say $n=2^a m$, where $m$ is odd and $a \geq 1$, we then have $$2^am-2 = n-2 = \phi(n) = 2^{a-1} \phi(m) \leq 2^{a-1}m \implies 2m-2^{2-a} \leq m$$ This gives us that $m \leq 2^{2-a}$. Hence, only possibility is $a=2$, which gives us $m \leq 1$, which gives us $n=4$.

  • $n$ is an odd prime: Then $\phi(n) = n-1 \neq n-2$

  • $n$ is odd composite but has two distinct factors, i.e, $n=ab$, where $1
  • $n$ is odd composite but a prime square, i.e, $n=a^2$, where $1

So only solution is $n=4$.

  • 0
    If $n$ is odd $\phi(n)$ is even. You don't need to go any further.2017-02-07
1

Since $n$ is not prime, it is divisible by some primes. Let $p$ be the smallest prime dividing $n$.

Then $p$ and $n$ are not relatively prime with $n$. Since $\phi(n)=n-2$ these are the only two.

But then $2p$ is not relatively prime with $n$ either, and hence $n=2p$.

Since $p$ is the smallest prime dividing $n$ and $n=2p$ is even, we get that $p=2$ and hence $n=4$.

0

Suppose $\psi (n)=n-2.$ Obviously $n>1.$ Let $P$ be the set of prime divisors of $n.$ For any $p\in P$ we have $$n(1-1/p)\geq n\prod_{q\in P}(1-1/q)=\psi (n)=n-2 \implies$$ $$\implies n(1-1/p)\geq n-2 \implies p\geq n/2 \implies$$ $$\implies (p=n\lor p=n/2).$$ The last line above follows from $(p|n\land p\geq n/2).$

Now we cannot have $p=n,$ else $\psi (n)=\psi (p)=p-1=n-1.$ So we have $p\in P\implies p=n/2,$ so the only prime divisor of $n$ is $n/2.$ But if $n/2$ is an integer then $2$ is a prime divisor of $n.$ So $2=p=n/2$ and $n=4.$

Therefore $\psi (n)=n-2\implies n=4.$ We also have (obviously) $n=4\implies \psi (n)=n-2.$