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.

Showing 1-6 of 6 results.

A076409 Sum of the quadratic residues of prime(n).

Original entry on oeis.org

1, 1, 5, 7, 22, 39, 68, 76, 92, 203, 186, 333, 410, 430, 423, 689, 767, 915, 1072, 994, 1314, 1343, 1577, 1958, 2328, 2525, 2369, 2675, 2943, 3164, 3683, 3930, 4658, 4587, 5513, 5134, 6123, 6520, 6012, 7439, 7518, 8145, 7831, 9264, 9653, 8955, 10761, 11596
Offset: 1

Views

Author

R. K. Guy, Oct 08 2002

Keywords

Comments

Row sums of A063987. - R. J. Mathar, Jan 08 2015
prime(n) divides a(n) for n > 2. This is implied by a variant of Wolstenholme's theorem (see Hardy & Wright reference). - Isaac Saffold, Jun 21 2018

Examples

			If n = 3, then p = 5 and a(3) = 1 + 4 = 5. If n = 4, then p = 7 and a(4) = 1 + 4 + 2 = 7. If n = 5, then p = 11 and a(5) = 1 + 4 + 9 + 5 + 3 = 22. - _Michael Somos_, Jul 01 2018
		

References

  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 4th ed., Oxford Univ. Press, 1960, p. 88-90.
  • Kenneth A. Ribet, Modular forms and Diophantine questions, Challenges for the 21st century (Singapore 2000), 162-182; World Sci. Publishing, River Edge NJ 2001; Math. Rev. 2002i:11030.

Crossrefs

Cf. A076410.
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
    A076409 := proc(n)
      local a,p,i ;
      p := ithprime(n) ;
      a := 0 ;
      for i from 1 to p-1 do
        if numtheory[legendre](i,p) = 1 then
           a := a+i ;
        end if;
      end do;
      a ;
    end proc: # R. J. Mathar, Feb 26 2011
  • Mathematica
    Join[{1,1}, Table[ Apply[ Plus, Flatten[ Position[ Table[ JacobiSymbol[i, Prime[n]], {i, 1, Prime[n] - 1}], 1]]], {n, 3, 48}]]
    Join[{1}, Table[p=Prime[n]; If[Mod[p,4]==1, p(p-1)/4, Sum[PowerMod[k,2, p],{k,p/2}]], {n,2,1000}]] (* Zak Seidov, Nov 02 2011 *)
    a[ n_] := If[ n < 3, Boole[n > 0], With[{p = Prime[n]}, Sum[ Mod[k^2, p], {k, (p - 1)/2}]]]; (* Michael Somos, Jul 01 2018 *)
  • PARI
    a(n,p=prime(n))=if(p<5,return(1)); if(k%4==1, return(p\4*p)); sum(k=1,p-1,k^2%p) \\ Charles R Greathouse IV, Feb 21 2017

Formula

If prime(n) = 4k+1 then a(n) = k*(4k+1).
For n>2 if prime(n) = 4k+3 then a(n) = (k - b)*(4k+3) where b = (h(-p) - 1) / 2; h(-p) = A002143. For instance. If n=5, p=11, k=2, b=(1-1)/2=0 and a(5) = 2*11 = 22. If n=20, p=71, k=17, b=(7-1)/2=3 and a(20) = 14*71 = 994. - Andrés Ventas, Mar 01 2021

Extensions

Edited and extended by Robert G. Wilson v, Oct 09 2002

A282035 Sum of quadratic residues of (n-th prime == 3 mod 4).

Original entry on oeis.org

1, 7, 22, 76, 92, 186, 430, 423, 767, 1072, 994, 1343, 1577, 2369, 2675, 3683, 3930, 4587, 5134, 6520, 6012, 7518, 7831, 8955, 10761, 11596, 12258, 12428, 14809, 15517, 16802, 19527, 23025, 21148, 26811, 29148, 28720, 31929, 35247, 33321, 41900, 41807, 44778, 47844, 51856, 52771, 51253, 57466
Offset: 1

Views

Author

N. J. A. Sloane, Feb 20 2017

Keywords

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 200 do
    p:=ithprime(i1);
    if (p mod 4) = 3 then
    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];
    fi;
    od:
    a; m; d; # A282035, A282036, A282037
  • Mathematica
    Table[Table[Mod[a^2, p], {a, 1, (p-1)/2}]//Total, {p, Select[Prime[Range[100]], Mod[#, 4]==3 &]}] (* Vincenzo Librandi, Feb 21 2017 *)
    Table[Total[PowerMod[#,2,n]&/@Range[n/2]],{n,Select[Prime[Range[100]],Mod[#,4]==3&]}] (* Harvey P. Dale, Dec 11 2024 *)
  • PARI
    do(p)=sum(k=1,p-1,k^2%p)/2
    apply(do, select(p->p%4==3, primes(100))) \\ Charles R Greathouse IV, Feb 21 2017

A125615 Sum of the quadratic nonresidues of prime(n).

Original entry on oeis.org

0, 2, 5, 14, 33, 39, 68, 95, 161, 203, 279, 333, 410, 473, 658, 689, 944, 915, 1139, 1491, 1314, 1738, 1826, 1958, 2328, 2525, 2884, 2996, 2943, 3164, 4318, 4585, 4658, 5004, 5513, 6191, 6123, 6683, 7849, 7439, 8413, 8145, 10314, 9264, 9653, 10746, 11394
Offset: 1

Views

Author

Nick Hobson, Nov 30 2006

Keywords

Comments

For all n > 2, prime(n) divides a(n).

Examples

			The quadratic nonresidues of 7=prime(4) are 3, 5 and 6. Hence a(4) = 3+5+6 = 14.
		

References

  • D. M. Burton, Elementary Number Theory, McGraw-Hill, Sixth Edition (2007), p. 185.

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

  • Mathematica
    Table[p=Prime[n];Total[Complement[Range[p-1],Union[Table[PowerMod[k, 2, p], {k, p}]]]],{n,47}] (* James C. McMahon, Dec 19 2024 *)
  • PARI
    vector(47, n, p=prime(n); t=1; for(i=2, (p-1)/2, t+=((i^2)%p)); p*(p-1)/2-t)

Formula

If prime(n) = 4k+1 then a(n) = k(4k+1) = A076409(n).

A282036 a(n) is the sum of quadratic nonresidues of A002145(n) (the n-th prime == 3 mod 4).

Original entry on oeis.org

2, 14, 33, 95, 161, 279, 473, 658, 944, 1139, 1491, 1738, 1826, 2884, 2996, 4318, 4585, 5004, 6191, 6683, 7849, 8413, 10314, 10746, 11394, 13157, 13393, 16013, 16566, 18936, 19783, 20376, 23946, 27057, 27804, 30883, 35541, 35232, 36384, 39832, 45671, 50858, 51363, 50059, 55097, 56040
Offset: 1

Views

Author

N. J. A. Sloane, Feb 20 2017

Keywords

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.
Cf. A002145.

Programs

  • Maple
    with(numtheory):
    a:=[]; m:=[]; d:=[];
    for i1 from 1 to 200 do
    p:=ithprime(i1);
    if (p mod 4) = 3 then
    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];
    fi;
    od:
    a; m; d; # A282035, A282036, A282037
    # Alternative:
    f:= p -> add(-k^2 mod p, k=1..(p-1)/2)::
    map(f, select(isprime, [seq(p,p=3..1000,4)])); # Robert Israel, Nov 09 2020
  • Mathematica
    f[p_] := Total[Range[p-1] ~Complement~ Table[Mod[k^2, p], {k, (p-1)/2}] ]; f /@ Select[Range[3, 1000, 4], PrimeQ] (* Jean-François Alcover, Feb 16 2018, after Robert Israel *)
  • PARI
    lista(nn) = forprime(p=2, nn, if(p%4==3, print1(sum(k=1, p-1, if (!issquare(Mod(k, p)), k)), ", "))); \\ Michel Marcus, Nov 09 2020

Formula

a(n) = Sum_{k=1..(A002145(n)-1)/2} (-k^2) mod A002145(n). - J. M. Bergot and Robert Israel, Nov 09 2020

A282037 Let p = n-th prime == 3 mod 4; a(n) = (sum of quadratic nonresidues mod p) - (sum of quadratic residues mod p).

Original entry on oeis.org

1, 7, 11, 19, 69, 93, 43, 235, 177, 67, 497, 395, 249, 515, 321, 635, 655, 417, 1057, 163, 1837, 895, 2483, 1791, 633, 1561, 1135, 3585, 1757, 3419, 2981, 849, 921, 5909, 993, 1735, 6821, 3303, 1137, 6511, 3771, 9051, 6585, 2215, 3241, 3269, 11975, 3409, 4419, 1497, 10563, 2615, 1641, 5067, 2855
Offset: 1

Views

Author

N. J. A. Sloane, Feb 20 2017

Keywords

Comments

Equals A282036 - A282035.

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 200 do
    p:=ithprime(i1);
    if (p mod 4) = 3 then
    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];
    fi;
    od:
    a; m; d; # A282035, A282036, A282037
  • Mathematica
    sum[p_] := Total[If[JacobiSymbol[#, p] == 1, -#, #]& /@ Range[p-1]];
    sum /@ Select[Prime[Range[200]], Mod[#, 4] == 3&] (* Jean-François Alcover, Aug 31 2018 *)

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
Showing 1-6 of 6 results.