%I M2684 N1074 #77 Jul 22 2019 17:27:07
%S 3,7,23,71,311,479,1559,5711,10559,18191,31391,422231,701399,366791,
%T 3818929,9257329,22000801,36415991,48473881,175244281,120293879,
%U 427733329,131486759,3389934071,2929911599,7979490791,36504256799,23616331489,89206899239,121560956039
%N a(n) is the least number m such that the n-th prime is the least quadratic nonresidue modulo m.
%C Note that a(n) is always a prime q > prime(n).
%C For n > 1, a(n) = prime(k), where k is the smallest number such that A053760(k) = prime(n).
%C One could make a case for setting a(1) = 2, but a(1) = 3 seems more in keeping with the spirit of the sequence.
%C a(n) is the smallest odd prime q such that prime(n)^((q-1)/2) == -1 (mod q) and b^((q-1)/2) == 1 (mod q) for every natural base b < prime(n). - _Thomas Ordowski_, May 02 2019
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H N. J. A. Sloane, <a href="/A000229/b000229.txt">Table of n, a(n) for n = 1..38</a> (from the web page of Tomás Oliveira e Silva)
%H H. J. Godwin, <a href="http://dx.doi.org/10.1017/S0305004100039025">On the least quadratic non-residue</a>, Proc. Camb. Phil. Soc., 61 (3) (1965), 671-672.
%H A. J. Hanson, G. Ortiz, A. Sabry and Y.-T. Tai, <a href="http://arxiv.org/abs/1305.3292">Discrete Quantum Theories</a>, arXiv preprint arXiv:1305.3292 [quant-ph], 2013.
%H A. J. Hanson, G. Ortiz, A. Sabry, Y.-T. Tai, <a href="http://www.cs.indiana.edu/~sabry/papers/saskatoon-talk.pdf">Discrete quantum theories</a>, (a different version). (To appear in J. Phys. A: Math. Theor., 2014).
%H Tomás Oliveira e Silva, <a href="http://sweet.ua.pt/tos/p_roots.html">Least primitive root of prime numbers</a>
%H Hans Salié, <a href="http://dx.doi.org/10.1002/mana.19650290109">Uber die kleinste Primzahl, die eine gegebene Primzahl als kleinsten positiven quadratischen Nichtrest hat</a>, Math. Nachr. 29 (1965) 113-114.
%H Yu-Tsung Tai, <a href="https://scholarworks.iu.edu/dspace/bitstream/handle/2022/23178/dissertation.pdf">Discrete Quantum Theories and Computing</a>, Ph.D. thesis, Indiana University (2019).
%e a(2) = 7 because the second prime is 3 and 3 is the least quadratic nonresidue modulo 7, 14, 17, 31, 34, ... and 7 is the least of these.
%t leastNonRes[p_] := For[q = 2, True, q = NextPrime[q], If[JacobiSymbol[q, p] != 1, Return[q]]]; a[1] = 3; a[n_] := For[pn = Prime[n]; k = 1, True, k++, an = Prime[k]; If[pn == leastNonRes[an], Print[n, " ", an]; Return[an]]]; Array[a, 20] (* _Jean-François Alcover_, Nov 28 2015 *)
%Y Cf. A020649, A025021, A053760, A307809. For records see A133435.
%Y Differs from A002223, A045535 at 12th term.
%K nonn,nice
%O 1,1
%A _N. J. A. Sloane_
%E Definition corrected by Melvin J. Knight (MELVIN.KNIGHT(AT)ITT.COM), Dec 08 2006
%E Name edited by _Thomas Ordowski_, May 02 2019