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.

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

This page as a plain text file.
%I A282722 #16 Nov 27 2017 10:41:39
%S A282722 0,9,44,293,461,758,1022,1799,2530,3171,4778,5068,7662,8470,9993,
%T A282722 14097,16674,19467,20755,25701,29042,34471,37506,40661,45066,48541,
%U A282722 54324,54224,58135,60351,68593,75432,74014,83881,85900,98518,112000,117443,122241,132125,143322,151299,163180,161975,181191
%N A282722 Let p = n-th prime == 3 mod 8; a(n) = sum of quadratic residues mod p that are > p/2.
%H A282722 Jean-François Alcover, <a href="/A282722/b282722.txt">Table of n, a(n) for n = 1..1000</a>
%H A282722 Christian Aebi, Grant Cairns, <a href="http://arxiv.org/abs/1512.00896">Sums of Quadratic residues and nonresidues</a>, arXiv:1512.00896 [math.NT], 2015.
%p A282722 with(numtheory):
%p A282722 Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[]; Th:=[];
%p A282722 for i1 from 1 to 300 do
%p A282722 p:=ithprime(i1);
%p A282722 if (p mod 8) = 3 then
%p A282722 ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0;
%p A282722 for j from 1 to p-1 do
%p A282722 if legendre(j,p)=1 then
%p A282722 q:=q+j;
%p A282722 if j<p/2 then ql:=ql+j; else qu:=qu+j; fi;
%p A282722 else
%p A282722 n:=n+j;
%p A282722 if j<p/2 then nl:=nl+j; else nu:=nu+j; fi;
%p A282722 fi;
%p A282722 od;
%p A282722 Ql:=[op(Ql),ql];
%p A282722 Qu:=[op(Qu),qu];
%p A282722 Q:=[op(Q),q];
%p A282722 Nl:=[op(Nl),nl];
%p A282722 Nu:=[op(Nu),nu];
%p A282722 N:=[op(N),n];
%p A282722 Th:=[op(Th),q+ql];
%p A282722 fi;
%p A282722 od:
%p A282722 Ql; Qu; Q; Nl; Nu; N; Th; # A282721 - A282727
%p A282722 # 2nd program
%p A282722 A282722 := proc(n)
%p A282722     local p,ar;
%p A282722     p := A007520(n) ;
%p A282722     a := 0 ;
%p A282722     for r from (p+1)/2 to p do
%p A282722         if numtheory[legendre](r,p) = 1 then
%p A282722             a := a+r ;
%p A282722         end if;
%p A282722     end do:
%p A282722     a ;
%p A282722 end proc:
%p A282722 seq(A282722(n),n=1..10) ; # _R. J. Mathar_, Apr 07 2017
%t A282722 b[1] = 3; b[n_] := b[n] = Module[{p}, p = NextPrime[b[n - 1]]; While[Mod[p, 8] != 3, p = NextPrime[p]]; p];
%t A282722 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];
%t A282722 Array[a, 45] (* _Jean-François Alcover_, Nov 27 2017, after _R. J. Mathar_ *)
%Y A282722 Cf. A282035-A282043 and A282721-A282727.
%K A282722 nonn
%O A282722 1,2
%A A282722 _N. J. A. Sloane_, Feb 20 2017