Determine all integers $n$ such that there exists an integer $a$ satisfying $a^{\frac{\varphi(n)}{2}} \equiv -1 \pmod{n}$ (where $\varphi$ is the Euler's totient function).
We want an integer $a$ such that $a^{\frac{\varphi(n)}{2}} \equiv -1 \pmod{n}$, hence $\omega_{n}(a) \mid \frac{\varphi(n)}{2}$. We use the same technique as before to compute the maximal order modulo $n$ in terms of the prime factorization of $n$, and we see that the only possible $n$ are $4, p^{k}$, and $2 p^{k}$ ($p$ an odd prime).