reviewed
approved
reviewed
approved
proposed
reviewed
editing
proposed
Christian Aebi, and Grant Cairns, <a href="http://arxiv.org/abs/1512.00896">Sums of Quadratic residues and nonresidues</a>, arXiv:1512.00896 [math.NT], 2015.
proposed
editing
editing
proposed
def v(x, r):
def v(x, r): return 2*x if x<=r else x
.... r=(p - 1)//2
.... return sum([v((j**2)%p, r) for j in range(1, r + 1)])
print ([a(p) for p in range(3, 2001, 8) if isprime(p)] ) # Indranil Ghosh, Mar 27 2017 translated from Robert Israel's Maple program
approved
editing
....return sum([v((j**2)%p, r) for j in xrangerange(1, r + 1)])
print [a(p) for p in xrangerange(3, 2001, 8) if isprime(p)] # Indranil Ghosh, Mar 27 2017 translated from Robert Israel's Maple program
proposed
approved
editing
proposed
v[x_, r_] := If[x <= r, 2*x, x];
f[p_] := Module[{r}, r = (p-1)/2; Sum[v[PowerMod[j, 2, p], r], {j, 1, r}]];
f /@ Select[Range[3, 1000, 8], PrimeQ] (* Jean-François Alcover, Nov 27 2017, after Robert Israel *)
approved
editing