login
A111987
Least number having n quadratic residues, or 0 if there is no number.
3
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,2
EXAMPLE
a(4)=6 because, of the five numbers having 4 quadratic residues (6,7,9,12,16), the least is 6.
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}]
CROSSREFS
Cf. A037046 (n such that a(n)=0), A111986 (number of numbers having n quadratic residues), A111988 (greatest number having n quadratic residues).
Sequence in context: A127598 A196550 A011037 * A004650 A138279 A131800
KEYWORD
nonn
AUTHOR
T. D. Noe, Aug 25 2005
STATUS
approved