This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A282727 #33 Mar 21 2021 13:06:34 %S A282727 2,35,108,567,1073,1386,2132,3551,5330,6003,8262,9968,13860,16046, %T A282727 19625,24957,29376,34155,37541,44793,54758,61217,68036,75215,77688, %U A282727 85347,93366,98912,101745,107531,119583,129042,135548,145607,149040,170478,193356,205335,213521,230373,243432,256851,280016,294395 %N A282727 Let p = n-th prime == 3 mod 8; a(n) = (sum of quadratic residues mod p that are < p/2) + (sum of all quadratic residues mod p). %C A282727 This is also the (sum of quadratic nonresidues mod p that are < p/2) + (sum of all quadratic nonresidues mod p) (= A282721 + A282723 = A282724 + A282726). %H A282727 Robert Israel, <a href="/A282727/b282727.txt">Table of n, a(n) for n = 1..4000</a> %H A282727 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. %p A282727 with(numtheory): %p A282727 Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[]; Th:=[]; %p A282727 for i1 from 1 to 300 do %p A282727 p:=ithprime(i1); %p A282727 if (p mod 8) = 3 then %p A282727 ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0; %p A282727 for j from 1 to p-1 do %p A282727 if legendre(j,p)=1 then %p A282727 q:=q+j; %p A282727 if j<p/2 then ql:=ql+j; else qu:=qu+j; fi; %p A282727 else %p A282727 n:=n+j; %p A282727 if j<p/2 then nl:=nl+j; else nu:=nu+j; fi; %p A282727 fi; %p A282727 od; %p A282727 Ql:=[op(Ql),ql]; %p A282727 Qu:=[op(Qu),qu]; %p A282727 Q:=[op(Q),q]; %p A282727 Nl:=[op(Nl),nl]; %p A282727 Nu:=[op(Nu),nu]; %p A282727 N:=[op(N),n]; %p A282727 Th:=[op(Th),q+ql]; %p A282727 fi; %p A282727 od: %p A282727 Ql; Qu; Q; Nl; Nu; N; Th; # A282721 - A282727 %p A282727 # Alternative: %p A282727 v:= proc(x,r) if x <= r then 2*x else x fi end proc: %p A282727 f:= proc(p) local q, r, j; %p A282727 r:= (p-1)/2; %p A282727 add(v(j^2 mod p, r), j=1..r) %p A282727 end proc: %p A282727 map(f, select(isprime, [seq(i,i=3..1000,8)])); # _Robert Israel_, Mar 27 2017 %t A282727 v[x_, r_] := If[x <= r, 2*x, x]; %t A282727 f[p_] := Module[{r}, r = (p-1)/2; Sum[v[PowerMod[j, 2, p], r], {j, 1, r}]]; %t A282727 f /@ Select[Range[3, 1000, 8], PrimeQ] (* _Jean-François Alcover_, Nov 27 2017, after _Robert Israel_ *) %o A282727 (Python) %o A282727 from sympy import isprime %o A282727 def v(x, r): %o A282727 return 2*x if x<=r else x %o A282727 def a(p): %o A282727 r=(p - 1)//2 %o A282727 return sum(v((j**2)%p, r) for j in range(1, r + 1)) %o A282727 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 %Y A282727 Cf. A282035-A282043 and A282721-A282726. %K A282727 nonn %O A282727 1,1 %A A282727 _N. J. A. Sloane_, Feb 20 2017