login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons 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
1, 13, 32, 137, 306, 314, 555, 876, 1400, 1416, 1742, 2450, 3099, 3788, 4816, 5430, 6351, 7344, 8393, 9546, 12858, 13373, 15265, 17277, 16311, 18403, 19521, 22344, 21805, 23590, 25495, 26805, 30767, 30863, 31570, 35980, 40678, 43946, 45640, 49124, 50055, 52776, 58418, 66210, 71521, 71665, 83666, 81628 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

LINKS

Robert Israel, Table of n, a(n) for n = 1..4000

Christian Aebi and Grant Cairns, Sums of Quadratic residues and nonresidues, arXiv:1512.00896 [math.NT], 2015.

MAPLE

with(numtheory):

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

for i1 from 1 to 300 do

p:=ithprime(i1);

if (p mod 8) = 3 then

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

for j from 1 to p-1 do

if legendre(j, p)=1 then

  q:=q+j;

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

else

  n:=n+j;

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

fi;

                    od;

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

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

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

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

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

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

Th:=[op(Th), q+ql];

fi;

od:

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

# Alternative

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

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

  for j from 1 to r do

    q:= j^2 mod p;

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

od:

t

end proc:

map(f, select(isprime, [seq(i, i=3..10000, 8)])); # Robert Israel, Mar 27 2017

MATHEMATICA

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

s /@ Select[Range[3, 2000, 8], PrimeQ] (* Jean-Fran├žois Alcover, Nov 17 2017 *)

PROG

(Python)

from sympy import isprime

def a(p):

    r=(p - 1)//2

    t=0

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

        q=(j**2)%p

        if q<=r:t+=q

    return t

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

CROSSREFS

Cf. A282035-A282043 and A282722-A282727.

Sequence in context: A118513 A212757 A140678 * A206345 A284862 A213686

Adjacent sequences:  A282718 A282719 A282720 * A282722 A282723 A282724

KEYWORD

nonn

AUTHOR

N. J. A. Sloane, Feb 20 2017

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 16 04:56 EDT 2021. Contains 345056 sequences. (Running on oeis4.)