login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A282722
Let p = n-th prime == 3 mod 8; a(n) = sum of quadratic residues mod p that are > p/2.
2
0, 9, 44, 293, 461, 758, 1022, 1799, 2530, 3171, 4778, 5068, 7662, 8470, 9993, 14097, 16674, 19467, 20755, 25701, 29042, 34471, 37506, 40661, 45066, 48541, 54324, 54224, 58135, 60351, 68593, 75432, 74014, 83881, 85900, 98518, 112000, 117443, 122241, 132125, 143322, 151299, 163180, 161975, 181191
OFFSET
1,2
LINKS
Jean-François Alcover, Table of n, a(n) for n = 1..1000
Christian Aebi, 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
# 2nd program
A282722 := proc(n)
local p, ar;
p := A007520(n) ;
a := 0 ;
for r from (p+1)/2 to p do
if numtheory[legendre](r, p) = 1 then
a := a+r ;
end if;
end do:
a ;
end proc:
seq(A282722(n), n=1..10) ; # R. J. Mathar, Apr 07 2017
MATHEMATICA
b[1] = 3; b[n_] := b[n] = Module[{p}, p = NextPrime[b[n - 1]]; While[Mod[p, 8] != 3, p = NextPrime[p]]; p];
a[n_] := Module[{p, q, r}, p = b[n]; q = 0; For[r = (p + 1)/2, r <= p, r++, If[KroneckerSymbol[r, p] == 1, q = q + r]]; q];
Array[a, 45] (* Jean-François Alcover, Nov 27 2017, after R. J. Mathar *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 20 2017
STATUS
approved