login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A282039 Let p = n-th prime == 7 mod 8; a(n) = sum of quadratic residues mod p that are < p/2. 5

%I #15 Nov 09 2020 20:34:03

%S 3,33,60,138,315,390,663,1008,1425,1743,2280,2475,3108,3570,4323,4590,

%T 6045,8055,8418,9168,11610,12045,13398,14340,14823,15813,22425,23028,

%U 24885,26163,32310,33033,34503,35250,42333,43995,46548,49173,51870,52785,58443,60393,61380,66435,67470,70623

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

%H Robert Israel, <a href="/A282039/b282039.txt">Table of n, a(n) for n = 1..10000</a>

%H 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 with(numtheory):

%p Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[];

%p for i1 from 1 to 300 do

%p p:=ithprime(i1);

%p if (p mod 8) = 7 then

%p ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0;

%p for j from 1 to p-1 do

%p if legendre(j,p)=1 then

%p q:=q+j;

%p if j<p/2 then ql:=ql+j; else qu:=qu+j; fi;

%p else

%p n:=n+j;

%p if j<p/2 then nl:=nl+j; else nu:=nu+j; fi;

%p fi;

%p od;

%p Ql:=[op(Ql),ql];

%p Qu:=[op(Qu),qu];

%p Q:=[op(Q),q];

%p Nl:=[op(Nl),nl];

%p Nu:=[op(Nu),nu];

%p N:=[op(N),n];

%p fi;

%p od:

%p Ql; Qu; Q; Nl; Nu; N; # A282039, A282040, A282041, A282039 again, A282042, A282043

%p # alternative:

%p g:= proc(t,p) if t < p/2 then t else 0 fi end proc;

%p f:= proc(n) local k;

%p add(g(k^2 mod n, n),k=1..n/2)

%p end proc:

%p P:= select(isprime, [seq(i,i=7..3000,8)]):

%p map(f,P); # _Robert Israel_, Nov 09 2020

%t sum[p_]:= Total[If[#<p/2 && JacobiSymbol[#, p] != 1, #, 0]& /@ Range[p-1]];

%t sum /@ Select[Range[7, 1100, 8], PrimeQ] (* _Jean-François Alcover_, Aug 31 2018 *)

%Y Cf. A282035-A282043 and A282721-A282727.

%K nonn

%O 1,1

%A _N. J. A. Sloane_, Feb 20 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 05:19 EDT 2024. Contains 371782 sequences. (Running on oeis4.)