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.

A282038 (Sum of the quadratic nonresidues of prime(n)) - (sum of the quadratic residues of prime(n)).

Original entry on oeis.org

-1, 1, 0, 7, 11, 0, 0, 19, 69, 0, 93, 0, 0, 43, 235, 0, 177, 0, 67, 497, 0, 395, 249, 0, 0, 0, 515, 321, 0, 0, 635, 655, 0, 417, 0, 1057, 0, 163, 1837, 0, 895, 0, 2483, 0, 0, 1791, 633, 1561, 1135, 0, 0, 3585, 0, 1757, 0, 3419, 0, 2981, 0, 0, 849, 0, 921, 5909, 0, 0, 993, 0, 1735, 0, 0, 6821, 3303, 0
Offset: 1

Views

Author

N. J. A. Sloane, Feb 20 2017

Keywords

Comments

Equals 0 if p == 1 (mod 4).

Crossrefs

Sums of residues, nonresidues, and their differences, for p == 1 (mod 4), p == 3 (mod 4), and all p: A171555; A282035, A282036, A282037; A076409, A125615, A282038.

Programs

  • Maple
    with(numtheory):
    a:=[]; m:=[]; d:=[];
    for i1 from 1 to 100 do
    p:=ithprime(i1);
    sp:=0; sm:=0;
    for j from 1 to p-1 do
    if legendre(j,p)=1 then sp:=sp+j; else sm:=sm+j; fi; od;
    a:=[op(a),sp]; m:=[op(m),sm]; d:=[op(d),sm-sp];
    od:
    a; m; d; # A076409, A125615, A282038
  • Mathematica
    sum[p_] := Total[If[JacobiSymbol[#, p] == 1, -#, #]& /@ Range[p-1]];
    a[n_] := sum[Prime[n]];
    Array[a, 100] (* Jean-François Alcover, Aug 31 2018 *)
  • PARI
    a(n) = my (p=prime(n)); return (sum(i=1, p-1, if (kronecker(i,p)==1, -i, +i))) \\ Rémy Sigrist, Apr 28 2017