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!)
A282721 Let p = n-th prime == 3 mod 8; a(n) = sum of quadratic residues mod p that are < p/2. 12

%I #32 Mar 24 2021 09:57:46

%S 1,13,32,137,306,314,555,876,1400,1416,1742,2450,3099,3788,4816,5430,

%T 6351,7344,8393,9546,12858,13373,15265,17277,16311,18403,19521,22344,

%U 21805,23590,25495,26805,30767,30863,31570,35980,40678,43946,45640,49124,50055,52776,58418,66210,71521,71665,83666,81628

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

%H Robert Israel, <a href="/A282721/b282721.txt">Table of n, a(n) for n = 1..4000</a>

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

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

%p for i1 from 1 to 300 do

%p p:=ithprime(i1);

%p if (p mod 8) = 3 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 Th:=[op(Th),q+ql];

%p fi;

%p od:

%p Ql; Qu; Q; Nl; Nu; N; Th; # A282721 - A282727

%p # Alternative

%p f:= proc(p) local q,r,t,j;

%p r:= (p-1)/2; t:= 0;

%p for j from 1 to r do

%p q:= j^2 mod p;

%p if q <= r then t:= t+q fi;

%p od:

%p t

%p end proc:

%p map(f, select(isprime, [seq(i,i=3..10000,8)])); # _Robert Israel_, Mar 27 2017

%t s[p_] := Total[Select[Range[Floor[p/2]], JacobiSymbol[#, p] == 1&]];

%t s /@ Select[Range[3, 2000, 8], PrimeQ] (* _Jean-François Alcover_, Nov 17 2017 *)

%o (Python)

%o from sympy import isprime

%o def a(p):

%o r=(p - 1)//2

%o t=0

%o for j in range(1, r + 1):

%o q=(j**2)%p

%o if q<=r:t+=q

%o return t

%o print([a(p) for p in range(3, 2001, 8) if isprime(p)]) # _Indranil Ghosh_, Mar 27 2017, translated from Maple code

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

%K nonn

%O 1,2

%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 24 14:32 EDT 2024. Contains 371960 sequences. (Running on oeis4.)