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 A282721 #32 Mar 24 2021 09:57:46 %S A282721 1,13,32,137,306,314,555,876,1400,1416,1742,2450,3099,3788,4816,5430, %T A282721 6351,7344,8393,9546,12858,13373,15265,17277,16311,18403,19521,22344, %U A282721 21805,23590,25495,26805,30767,30863,31570,35980,40678,43946,45640,49124,50055,52776,58418,66210,71521,71665,83666,81628 %N A282721 Let p = n-th prime == 3 mod 8; a(n) = sum of quadratic residues mod p that are < p/2. %H A282721 Robert Israel, <a href="/A282721/b282721.txt">Table of n, a(n) for n = 1..4000</a> %H A282721 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 A282721 with(numtheory): %p A282721 Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[]; Th:=[]; %p A282721 for i1 from 1 to 300 do %p A282721 p:=ithprime(i1); %p A282721 if (p mod 8) = 3 then %p A282721 ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0; %p A282721 for j from 1 to p-1 do %p A282721 if legendre(j,p)=1 then %p A282721 q:=q+j; %p A282721 if j<p/2 then ql:=ql+j; else qu:=qu+j; fi; %p A282721 else %p A282721 n:=n+j; %p A282721 if j<p/2 then nl:=nl+j; else nu:=nu+j; fi; %p A282721 fi; %p A282721 od; %p A282721 Ql:=[op(Ql),ql]; %p A282721 Qu:=[op(Qu),qu]; %p A282721 Q:=[op(Q),q]; %p A282721 Nl:=[op(Nl),nl]; %p A282721 Nu:=[op(Nu),nu]; %p A282721 N:=[op(N),n]; %p A282721 Th:=[op(Th),q+ql]; %p A282721 fi; %p A282721 od: %p A282721 Ql; Qu; Q; Nl; Nu; N; Th; # A282721 - A282727 %p A282721 # Alternative %p A282721 f:= proc(p) local q,r,t,j; %p A282721 r:= (p-1)/2; t:= 0; %p A282721 for j from 1 to r do %p A282721 q:= j^2 mod p; %p A282721 if q <= r then t:= t+q fi; %p A282721 od: %p A282721 t %p A282721 end proc: %p A282721 map(f, select(isprime, [seq(i,i=3..10000,8)])); # _Robert Israel_, Mar 27 2017 %t A282721 s[p_] := Total[Select[Range[Floor[p/2]], JacobiSymbol[#, p] == 1&]]; %t A282721 s /@ Select[Range[3, 2000, 8], PrimeQ] (* _Jean-François Alcover_, Nov 17 2017 *) %o A282721 (Python) %o A282721 from sympy import isprime %o A282721 def a(p): %o A282721 r=(p - 1)//2 %o A282721 t=0 %o A282721 for j in range(1, r + 1): %o A282721 q=(j**2)%p %o A282721 if q<=r:t+=q %o A282721 return t %o A282721 print([a(p) for p in range(3, 2001, 8) if isprime(p)]) # _Indranil Ghosh_, Mar 27 2017, translated from Maple code %Y A282721 Cf. A282035-A282043 and A282722-A282727. %K A282721 nonn %O A282721 1,2 %A A282721 _N. J. A. Sloane_, Feb 20 2017