Can we prove or disprove (perhaps under some standard hypothesis): $$\text{If for the first }\|n\|\text{ primes }p_i, \left(\dfrac{p_i} n\right)=+1,\text{ then }n\text{ is a square.}$$
where $\|n\|$ is the number of bits in $n$, $\left(\dfrac p n\right)$ is the Kronecker symbol, and $p_i$ is the $i^\text{th}$ prime, starting with $p_1=2$. By contraposition, the proposition can also be stated as: $$\text{If }n\in\mathbb N\text{ is not a square, then }\exists\,i\in\mathbb N^*\text{ with }2^{i-1}\le n\text{ and }\left(\dfrac{p_i}n\right)\ne+1$$
I don't know a counterexample for the stronger proposition with $2^i\le n$.
The proposition holds
- For $n=0$, $n=1$, and more generally any $n$ that is a square.
- For even $n>0$, since for these $\left(\frac 2 n\right)=0\ne+1$. Thus we can restrict to odd $n$ and use the Jacobi symbol rather than the Kronecker symbol.
- If $n\bmod8\in\{3,5\}$, since for these $\left(\frac 2 n\right)=-1\ne+1$.
We can thus focus on $n\equiv\pm1\pmod8$, and turn to use of the Legendre symbol:
- for $n\equiv+1\pmod8$ and odd $p_i$, we can change $\left(\dfrac{p_i} n\right)=+1$ to $\left(\dfrac n{p_i}\right)=+1$
- for $n\equiv-1\pmod8$ and odd $p_i$, we can change $\left(\dfrac{p_i} n\right)=+1$ to $\left(\dfrac {-n}{p_i}\right)=+1$.
A closely related problem is studied by Richard F. Lukes, C. D. Patterson and Hugh C. Williams, Some results on pseudosquares, Math. Comp. 65 (1996), 361-372. The smallest $n$ for a given $i$ are the positive pseudosquares for $n\equiv+1\pmod8$, negative pseudosquares for $n\equiv-1\pmod8$. See A002189 and A045535.
Initial motivation: In some primality test algorithms we need the smallest $p_i$ with $\left(\dfrac{p_i}n\right)\ne+1$. The proposition tells that when finding none for $i\in\left[1,\|n\|\,\right]$, we can stop and declare there's no such $p_i$ since $n$ must be a square. If it was true, the proposition would avoid making an explicit square test.
Remark (not quite an argument): for a fixed small prime $p$ and a large random $n$, there is probability $\dfrac{p+1}{2p}>\dfrac 1 2$ that $\left(\dfrac p n\right)\ne+1$. The probabilities for small $p_i$ are only vanishingly correlated.
If we look at how many such tests we need, here are
◦ smallest non-square odd $n$ record-holders for high $\pi(p)$
◦ the smallest $p$ with $\left(\frac p n\right)\ne+1$
◦ the number $\|n\|$ of bits of $n$
◦ the index $\pi(p)$ per the prime counting function
◦ the margin $\Delta=\|n\|-\pi(p)$ there is for the proposition
◦ the kind of pseudosquare $n$: $-$ for $n\equiv-1\pmod8$, $+$ for $n\equiv+1\pmod8$
◦ the factorization of $n$ when composite
$$\begin{array}{|r|r|r|r|c|c|l|} \hline n&p&\!\|n\|\!&\pi(p)\!&\Delta&\text{kind}&\text{factors of }n\\ \hline 2&2&2&1&1&&\text{Prime}\\ 7&3&3&2&1&-&\text{Prime}\\ 23&5&5&3&2&-&\text{Prime}\\ 71&7&7&4&3&-&\text{Prime}\\ 311&11&9&5&4&-&\text{Prime}\\ 479&13&9&6&3&-&\text{Prime}\\ 1559&17&11&7&4&-&\text{Prime}\\ 5711&19&13&8&5&-&\text{Prime}\\ 10559&23&14&9&5&-&\text{Prime}\\ 18191&29&15&10&5&-&\text{Prime}\\ 31391&31&15&11&4&-&\text{Prime}\\ 118271&37&17&12&5&-&101\cdot1171\\ 366791&43&19&14&5&-&\text{Prime}\\ 2155919&59&22&17&5&-&59\cdot36541\\ 6077111&67&23&19&4&-&1039\cdot5849\\ 98538359&71&27&20&7&-&79\cdot1247321\\ 120293879&73&27&21&6&-&\text{Prime}\\ 131486759&83&27&23&4&-&\text{Prime}\\ 508095719&89&29&24&5&-&367\cdot547\cdot2531\\ 2570169839&113&32&30&2&-&439\cdot5854601\\ 196265095009&131&38&32&6&+&\text{Prime}\\ 513928659191&137&39&33&6&-&\text{Prime}\\ 844276851239&139&40&34&6&-&794239\cdot1063001\\ 1043702750999&149&40&35&5&-&389\cdot5689\cdot471619\\ 4306732833311&151&42&36&6&-&\text{Prime}\\ 8402847753431&157&43&37&6&-&\text{Prime}\\ 47375970146951&163&46&38&8&-&151717\cdot312265403\\ 52717232543951&167&46&39&7&-&223\cdot1747\cdot6863\cdot19717\\ 100535431791791&173&47&40&7&-&9873817\cdot10182023\\ 178936222537081&181&48&42&6&+&\text{Prime}\\ 493092541684679&193&49&44&5&-&4723\cdot104402401373\\ 1088144332169831&223&50&48&2&-&293\cdot464941\cdot7987687\\ 11641399247947921&227&54&49&5&+&\text{Prime}\\ 88163809868323439&229&57&50&7&-&96757\cdot911187923027\\ 196640248121928601&233&58&51&7&+&\text{Prime}\\ 423414931359807911&239&59&52&7&-&241\cdot1756908428878871\\ 695681268077667119&241&60&53&7&-&3413\cdot203832777051763\\ 1116971853972029831&257&60&55&5&-&1721\cdot869521\cdot746416591\\ 3546374752298322551&271&62&58&4&-&\text{Prime}\\ 10198100582046287689&277&64&59&5&+&277\cdot1091\cdot1151\cdot29318344777\\ \hline \end{array}$$
Values are extracted from Richard F. Lukes, A Very Fast Electronic Number Sieve, thesis presented to the University of Manitoba (1995), tables 6.22 (negative pseudosquares A045535) and 6.24 (positive pseudosquares A002189), and in the process of being independently verified. The terms to $\pi(p)=50$ also are in Nathan D. Bronson and Duncan A. Buell, Congruential Sieves on FPGA Computers, in Proceedings of Symposia in Applied Mathematics, Volume 48, 1994, 547-551.