A111987 Least number having n quadratic residues, or 0 if there is no number.
1, 2, 5, 6, 0, 10, 13, 14, 17, 19, 25, 22, 0, 26, 29, 31, 0, 34, 37, 38, 41, 43, 128, 46, 0, 0, 53, 78, 0, 58, 61, 62, 135, 67, 0, 71, 73, 74, 0, 79, 0, 82, 0, 86, 89, 384, 0, 94, 97, 0, 101, 103, 125, 106, 109, 121, 113, 0, 0, 118, 0, 122, 205, 127, 0, 131, 0, 134, 137, 139, 0
Offset: 1
Keywords
Examples
a(4)=6 because, of the five numbers having 4 quadratic residues (6,7,9,12,16), the least is 6.
Crossrefs
Programs
-
Mathematica
t=Table[Length[Union[Mod[Range[0, n/2]^2, n]]], {n, 10000}]; Table[pos=Flatten[Position[t, n]]; If[Length[pos]==0, 0, First[pos]], {n, 100}]