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 A282040 #17 Aug 22 2025 15:06:14 %S A282040 4,59,126,285,679,953,1706,2675,3709,4269,5551,6480,8488,8858,11194, %T A282040 12212,15103,20665,23511,24153,30197,32733,38458,36913,42643,42032, %U A282040 59638,64987,70396,70887,85606,94192,95522,99930,123090,117932,130367,134436,141262,149395,169769,167663,175469 %N A282040 Let p = n-th prime == 7 mod 8; a(n) = sum of quadratic residues mod p that are > p/2. %H A282040 Robert Israel, <a href="/A282040/b282040.txt">Table of n, a(n) for n = 1..10000</a> %H A282040 Christian Aebi and Grant Cairns. <a href="http://arxiv.org/abs/1512.00896">Sums of Quadratic residues and nonresidues</a>, arXiv preprint arXiv:1512.00896 [math.NT], 2015. %p A282040 with(numtheory): %p A282040 Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[]; %p A282040 for i1 from 1 to 300 do %p A282040 p:=ithprime(i1); %p A282040 if (p mod 8) = 7 then %p A282040 ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0; %p A282040 for j from 1 to p-1 do %p A282040 if legendre(j,p)=1 then %p A282040 q:=q+j; %p A282040 if j<p/2 then ql:=ql+j; else qu:=qu+j; fi; %p A282040 else %p A282040 n:=n+j; %p A282040 if j<p/2 then nl:=nl+j; else nu:=nu+j; fi; %p A282040 fi; %p A282040 od; %p A282040 Ql:=[op(Ql),ql]; %p A282040 Qu:=[op(Qu),qu]; %p A282040 Q:=[op(Q),q]; %p A282040 Nl:=[op(Nl),nl]; %p A282040 Nu:=[op(Nu),nu]; %p A282040 N:=[op(N),n]; %p A282040 fi; %p A282040 od: %p A282040 Ql; Qu; Q; Nl; Nu; N; # A282039, A282040, A282041, A282039 again, A282042, A282043 %p A282040 # alternative: %p A282040 g:= proc(t, p) if t > p/2 then t else 0 fi end proc; %p A282040 f:= proc(n) local k; %p A282040 add(g(k^2 mod n, n), k=1..n/2) %p A282040 end proc: %p A282040 P:= select(isprime, [seq(i, i=7..3000, 8)]): %p A282040 map(f, P); # _Robert Israel_, Aug 22 2025 %t A282040 sum[p_]:= Total[If[#>p/2 && JacobiSymbol[#, p] == 1, #, 0]& /@ Range[p-1]]; %t A282040 sum /@ Select[Range[7, 1000, 8], PrimeQ] (* _Jean-François Alcover_, Aug 31 2018 *) %Y A282040 Cf. A282035-A282043 and A282721-A282727. %K A282040 nonn %O A282040 1,1 %A A282040 _N. J. A. Sloane_, Feb 20 2017