A020649 Least quadratic nonresidue modulo n (with n >= 3).
2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 5, 5, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 7, 2, 5, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 5, 2, 2, 5, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2
Offset: 3
Keywords
Links
- Amiram Eldar, Table of n, a(n) for n = 3..10000
- Eric Weisstein's World of Mathematics, Quadratic Nonresidue
Crossrefs
Cf. A053760.
Programs
-
Mathematica
a[n_] := Min @ Complement[Range[n - 1], Mod[Range[n/2]^2, n]]; Table[a[n], {n, 3, 110}] (* Amiram Eldar, Oct 29 2020 *)
-
PARI
residue(n,m)={local(r);r=0;for(i=0,floor(m/2),if(i^2%m==n,r=1));r} A020649(n)={local(r,m);r=0;m=0;while(r==0,m=m+1;if(!residue(m,n),r=1));m} \\ Michael B. Porter, Apr 30 2010
Formula
a(prime(n)) = A053760(n) for n > 1. - Thomas Ordowski, Apr 24 2019
Comments