For a positive integer $n$, let $a(n)$ the smallest number $k>0$ such that $-n$ is not a quadratic residue modulo $k$.

Using CRT, we can prove that all values of $a(n)$ are prime powers, and every prime power except $2$ appears in the sequence.

See **OEIS A354597** .

It's easy to prove that $a(n)\leqslant4n-1$ (take a prime factor $p$ of $4n-1$ such that $p\equiv-1\,(\text{mod }4)$, then $-n$ is not a square modulo $p$).

But according to the figure below, it seems that we can improve the previous inequality !

How to proceed ?

Thanks !

**Remark :** This question has been asked previouly on **math.SE** but no response was given.