Noticed these two patterns while playing with Euler's totient function $\varphi(n)$ and primes:
$$\text{For } n \text{ even}, \text{ if } \varphi(n) = \frac{n-2}{2} \text{ then } \frac{n}{2} \text{ is prime.}$$
$$\text{For } n \text{ odd}, \text{ if } \varphi(n) = \frac{2n-6}{3} \text{ then } \frac{n}{3} \text{ is prime.}$$
Question
Are those known patterns? I searched but couldn't find anything similar.
We can prove both and more by generalizing slightly,
Theorem: Suppose $\varphi(n)=\frac{(p-1)n}{p}-(p-1)$ for some prime $p$. Then $p$ divides $n$ and $\frac{n}{p}$ is prime.
Proof: First we see that $p$ divides $n$ because $p(\varphi(n)+p-1)=(p-1)n$ and $p$ does not divide $p-1$.
Second, let $n=p^km$ with $p$ not dividing the integer $m$ and $k\ge 1$.
$$\varphi(n)=\frac{(p-1)n}{p}-(p-1)$$ $$\varphi(p^km)=\frac{(p-1)p^km}{p}-(p-1)$$ By multiplicativity, $\varphi(p^km)=\varphi(p^k)\varphi(m)$, $$p^{k-1}(p-1)\varphi(m)=(p-1)p^{k-1}m-(p-1)$$ $$\varphi(m)=m-\frac{1}{p^{k-1}}$$
Now because $m-\varphi(m)=\frac{1}{p^{k-1}}$ is an integer, this forces $k=1$.
$$\varphi(m)=m-1$$
This means $m$ is relatively prime to all $m-1$ numbers less than it, therefore $m$ is prime.