cp's OEIS Frontend

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.

A282039 Let p = n-th prime == 7 mod 8; a(n) = sum of quadratic residues mod p that are < p/2.

This page as a plain text file.
%I A282039 #15 Nov 09 2020 20:34:03
%S A282039 3,33,60,138,315,390,663,1008,1425,1743,2280,2475,3108,3570,4323,4590,
%T A282039 6045,8055,8418,9168,11610,12045,13398,14340,14823,15813,22425,23028,
%U A282039 24885,26163,32310,33033,34503,35250,42333,43995,46548,49173,51870,52785,58443,60393,61380,66435,67470,70623
%N A282039 Let p = n-th prime == 7 mod 8; a(n) = sum of quadratic residues mod p that are < p/2.
%H A282039 Robert Israel, <a href="/A282039/b282039.txt">Table of n, a(n) for n = 1..10000</a>
%H A282039 Aebi, Christian, and Grant Cairns. <a href="http://arxiv.org/abs/1512.00896">Sums of Quadratic residues and nonresidues</a>, arXiv preprint arXiv:1512.00896 (2015).
%p A282039 with(numtheory):
%p A282039 Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[];
%p A282039 for i1 from 1 to 300 do
%p A282039 p:=ithprime(i1);
%p A282039 if (p mod 8) = 7 then
%p A282039 ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0;
%p A282039 for j from 1 to p-1 do
%p A282039 if legendre(j,p)=1 then
%p A282039   q:=q+j;
%p A282039   if j<p/2 then ql:=ql+j; else qu:=qu+j; fi;
%p A282039 else
%p A282039   n:=n+j;
%p A282039   if j<p/2 then nl:=nl+j; else nu:=nu+j; fi;
%p A282039 fi;
%p A282039                     od;
%p A282039 Ql:=[op(Ql),ql];
%p A282039 Qu:=[op(Qu),qu];
%p A282039 Q:=[op(Q),q];
%p A282039 Nl:=[op(Nl),nl];
%p A282039 Nu:=[op(Nu),nu];
%p A282039 N:=[op(N),n];
%p A282039 fi;
%p A282039 od:
%p A282039 Ql; Qu; Q; Nl; Nu; N; # A282039, A282040, A282041, A282039 again, A282042, A282043
%p A282039 # alternative:
%p A282039 g:= proc(t,p) if t < p/2 then t else 0 fi end proc;
%p A282039 f:= proc(n) local k;
%p A282039      add(g(k^2 mod n, n),k=1..n/2)
%p A282039 end proc:
%p A282039 P:= select(isprime, [seq(i,i=7..3000,8)]):
%p A282039 map(f,P); # _Robert Israel_, Nov 09 2020
%t A282039 sum[p_]:= Total[If[#<p/2 && JacobiSymbol[#, p] != 1, #, 0]& /@ Range[p-1]];
%t A282039 sum /@ Select[Range[7, 1100, 8], PrimeQ] (* _Jean-François Alcover_, Aug 31 2018 *)
%Y A282039 Cf. A282035-A282043 and A282721-A282727.
%K A282039 nonn
%O A282039 1,1
%A A282039 _N. J. A. Sloane_, Feb 20 2017