OFFSET
2,4
COMMENTS
Up to n=3600, a(n) is equal to floor(n/2) 1262 times (about 35% of the cases).
Sometimes the ratio a(n)/n is unexpectedly low:
a(100)/100 = 24/100 = 0.24
a(144)/144 = 23/144 = 0.159722...
a(3600)/3600 = 539/3600 = 0.149722...
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 2..1000
Eric Weisstein's World of Mathematics, Quadratic Residue
EXAMPLE
For n = 100, one gets a(100) = 24 (far less than the expected floor(100/2) = 50).
MATHEMATICA
q[n_, k_] := Cases[Union[Mod[Range[k]^2, n]], _?Positive];
a[n_] := (r = q[n, Floor[n/2]]; k = 0; While[r != q[n, ++k]]; k); Table[a[n], {n, 2, 100}]
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jean-François Alcover, Feb 01 2011
EXTENSIONS
Formula and sequence corrected to eliminate zeros from lists of quadratic residues. Anyway, mod computed with or without offset 1 gives the same list.
STATUS
approved