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-9 of 9 results.

A088194 Members of the difference sequence (A088191) of the sequence of largest quadratic residues modulo the primes (A088190), where the latter is non-monotonic.

Original entry on oeis.org

0, 0, 0, -1, 0, 0, 0, 0, 0, -5, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -10, -1, 0, 0, 0, 0, 0, 0, -7, 0, -4, 0, -1, 0, -5, 0, 0, 0, 0, 0, -7, 0, -4, 0, 0, 0, 0, 0, -4, 0, 0, -2, 0, -1, 0, -5, 0, 0, 0, 0, -8, 0, 0, 0, 0, -4, -11, 0, 0, 0, -1, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -5, 0, 0, 0, 0, -5, 0, 0, -5, 0, 0, 0, -1
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu), Sep 22 2003

Keywords

Comments

The negative values are either primes or composites (Cf. A088200).

Crossrefs

Programs

  • PARI
    qrp_d_nm(to)= {/* The difference sequence values where the sequence of the largest QR modulo the primes is non-monotonic */ local(m,k=1,p,v=[]); for(i=2,to,m=1; p=prime(i); j=2; while((j<=(p-1)/2)&&(m
    				

A088192 Distance between prime(n) and the largest quadratic residue modulo prime(n).

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 1, 2, 5, 1, 3, 1, 1, 2, 5, 1, 2, 1, 2, 7, 1, 3, 2, 1, 1, 1, 3, 2, 1, 1, 3, 2, 1, 2, 1, 3, 1, 2, 5, 1, 2, 1, 7, 1, 1, 3, 2, 3, 2, 1, 1, 7, 1, 2, 1, 5, 1, 3, 1, 1, 2, 1, 2, 11, 1, 1, 2, 1, 2, 1, 1, 7, 3, 1, 2, 5, 1, 1, 1, 1, 2, 1, 7, 1, 3, 2, 1, 1, 1, 3, 2, 13, 3, 2, 2, 5, 1, 1, 2, 1
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu), Sep 22 2003

Keywords

Comments

a(n) = smallest m>0 such that -m is a quadratic residue modulo prime(n).
a(n) = smallest m>0 such that prime(n) either splits or ramifies in the imaginary quadratic field Q(sqrt(-m)). Equals -A220862(n) except when n = 1. Cf. A220861, A220863. - N. J. A. Sloane, Dec 26 2012
The values are 1 or a prime number (easily provable!). The maximum occurring prime values increase very slowly: up to 10^5 terms the largest prime is 43. The primes do not appear in order.

References

  • David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989, Cor. 5.17, p. 105. - From N. J. A. Sloane, Dec 26 2012

Crossrefs

Records are (essentially) given by A147971.

Programs

  • Mathematica
    a[n_] := With[{p = Prime[n]}, If[JacobiSymbol[-1, p] > 0, 1, For[d = 2, True, d = NextPrime[d], If[JacobiSymbol[-d, p] >= 0, Return[d]]]]]; Array[a, 100] (* Jean-François Alcover, Feb 16 2018, after Charles R Greathouse IV *)
  • PARI
    qrp_pm(fr,to)= {/* The distance of largest QR modulo the primes from the primes */ local(m,p,v=[]); for(i=fr,to,m=1; p=prime(i); j=2; while((j<=(p-1)/2)&&(m
    				
  • PARI
    do(p)=if(kronecker(-1,p)>0, 1, forprime(d=2, p, if(kronecker(-d, p) >= 0, return(d))))
    apply(do, primes(100)) \\ Charles R Greathouse IV, Oct 31 2012

Formula

a(n) = A053760(n) unless -1 is a quadratic residue mod prime(n). - Charles R Greathouse IV, Oct 31 2012

Extensions

Edited by Max Alekseyev, Oct 29 2012

A088190 Largest quadratic residue modulo prime(n).

Original entry on oeis.org

1, 1, 4, 4, 9, 12, 16, 17, 18, 28, 28, 36, 40, 41, 42, 52, 57, 60, 65, 64, 72, 76, 81, 88, 96, 100, 100, 105, 108, 112, 124, 129, 136, 137, 148, 148, 156, 161, 162, 172, 177, 180, 184, 192, 196, 196, 209, 220, 225, 228, 232, 232, 240, 249, 256, 258, 268, 268, 276
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu), Sep 22 2003

Keywords

Comments

Denote a(n) by LQR(p_n). Observations (tested up to 20000 primes): - the sequence of largest QR modulo the primes (LQR(p_n) is 'almost' monotonic, - p_n-LQR(p_n) is either 1 or a prime value (see A088192) - if LQR(p_n)<=LQR(p_{n-1}) then p_n==7 mod 8 (when n>2) (see A088194) - if LQR(p_n)<=LQR(p_{n-1}) then p_n-LQR(p_n) is an odd prime, but never 5 (see A088195) For a similar set of sequences, related to quadratic non-residues, see A088196-A088201.
From Robert Israel, Oct 31 2024: (Start)
a(n) = prime(n)-1 if and only if n is 1 or in A080147.
a(n) = prime(n)-2 if and only if prime(n) is in A007520.
a(n) = prime(n)-3 if and only if prime(n) is in A107006. (End)

Crossrefs

Programs

  • Maple
    lqr:= proc(p) local k;
      for k from p-1 by -1 do if numtheory:-quadres(k,p) = 1 then return k fi od:
    end proc:
    seq(lqr(ithprime(i)),i=1..100); # Robert Israel, Oct 31 2024
  • Mathematica
    a[n_] := With[{p = Prime[n]}, SelectFirst[Range[p - 1, 1, -1], JacobiSymbol[#, p] == 1&]]; Array[a, 100] (* Jean-François Alcover, Feb 16 2018 *)
  • PARI
    qrp(fr,to)= {/* Sequence of the largest QR modulo the primes */ local(m,p,v=[]); for(i=fr,to,m=1; p=prime(i); j=2; while((j<=(p-1)/2)&&(m
    				

Formula

a(n) = max(r, r==j^2 mod p(n)|j=1, 2, ...(p(n)-1)/2)

A088193 Prime numbers where the sequence of largest quadratic residues modulo the primes (A088190) is non-monotonic.

Original entry on oeis.org

3, 7, 31, 71, 103, 151, 199, 239, 271, 311, 359, 463, 599, 719, 823, 839, 911, 1063, 1231, 1279, 1303, 1439, 1559, 1871, 1879, 1951, 1999, 2143, 2239, 2311, 2351, 2383, 2399, 2551, 2711, 2791, 3191, 3391, 3463, 3559, 3583, 3823, 3911, 3919, 4079, 4159
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu), Sep 22 2003

Keywords

Comments

From the second term on, these primes are always ==7 mod 8. (Tested for the first 20000 primes)
From Robert Israel, Oct 31 2024: (Start)
This is true because if prime(n) == 1 mod 4, A088190(n) = prime(n) - 1 while if prime(n) == 3 mod 8, A088190(n) = prime(n) - 2. In either case, A088190(n) > prime(n-1) - 1 >= A088190(n-1).
Primes prime(n) such that A088190(n) <= A088190(n-1). (End)

Crossrefs

Programs

  • Maple
    lqr:= proc(p) local k;
      for k from p-1 by -1 do if numtheory:-quadres(k,p) = 1 then return k fi od:
    end proc:
    p:= 2: v:= lqr(2): R:= NULL: count:= 0:
    while count < 100 do
      q:= p; vq:= v; p:= nextprime(p); v:= lqr(p);
      if v <= vq then R:= R,p; count:= count+1;
      fi
    od:
    R; # Robert Israel, Oct 31 2024
  • PARI
    qrp_p_nm(to)= {/* The primes where the sequence of the largest QR modulo the primes is non-monotonic */ local(m,k=1,p,v=[]); for(i=2,to,m=1; p=prime(i); j=2; while((j<=(p-1)/2)&&(m
    				

A088195 Distance (A088192) of primes from the largest quadratic residues modulo the primes (A088190), where the latter is non-monotonic.

Original entry on oeis.org

3, 3, 3, 7, 3, 3, 3, 7, 3, 11, 7, 3, 7, 11, 3, 11, 7, 3, 3, 3, 3, 7, 17, 7, 3, 3, 3, 3, 3, 3, 13, 3, 11, 3, 7, 3, 11, 3, 3, 3, 3, 3, 13, 3, 11, 3, 3, 3, 3, 3, 11, 7, 11, 13, 3, 7, 7, 11, 7, 3, 3, 11, 19, 3, 11, 3, 3, 11, 17, 3, 11, 3, 7, 3, 13, 3, 3, 3, 3, 11, 11, 3, 3, 3, 3, 13, 19, 3, 3, 3, 7, 11
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu), Sep 22 2003

Keywords

Comments

The values are some odd primes, but never 5. The maximum value increases very slowly, it only reaches 31 for the first 20000 primes.
It is conjectured that if we denote the members of A088194 by D(n) and the member of this sequence by M(n) then if D(n)=-1 then M(n)=7, while if M(n)=3 then D(n)=0.
The values are odd primes, but never 5 (the primality is provable). The maximum value increases very slowly: it only reaches 43 for the first 10^5 primes.

Crossrefs

Programs

  • PARI
    qrp_pm_nm(to)= {/* The distance of LQR from the primes where the sequence of the largest QR modulo the primes is non-monotonic */ local(m,k=1,p,v=[]); for(i=2,to,m=1; p=prime(i); j=2; while((j<=(p-1)/2)&&(m
    				

A088197 First differences of A088196.

Original entry on oeis.org

1, 3, 4, 1, 3, 4, 4, 5, 3, 5, 3, 4, 4, 5, 7, 1, 7, 4, -2, 10, 4, 4, 6, 7, 3, 4, 1, 3, 16, 4, 4, 4, 9, 3, 5, 7, 4, 5, 7, 1, 11, -2, 7, 3, 12, 12, 4, 1, 3, 8, -4, 16, 4, 8, 5, 3, 5, 3, 4, 9, 15, 4, -2, 7, 15, 2, 14, 1, 3, 8, 8, 5, 7, 4, 5, 8, 3, 4, 16, 1, 11, -2, 10, 4, 4, 6, 7, 3, 4, 12, 8, 4, 8, 4, 5, 11, 4, 17
Offset: 2

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu), Sep 23 2003

Keywords

Crossrefs

Programs

  • PARI
    qnrp_d(n)= { /* The difference sequence of the sequence with the largest QnR modulo the primes */ local(k=1,m,p,fl,jj,j,v=[]); for(i=3,n,m=0; p=prime(i); jj=0; fl=2^p-1; j=2; while((j<=(p-1)/2),jj=(j^2)%p; fl-=2^jj; j++); j=p-1; while(m==0,if(bitand(2^j,fl),m=j); j--); v=concat(v,m-k); k=m); print(v)}

A091381 First differences of A091380.

Original entry on oeis.org

0, 2, 1, 5, 2, 3, 3, 1, 9, 1, 7, 3, 3, 1, 9, 6, 2, 6, -1, 4, 8, 5, 5, 6, 7, 1, 5, 2, 3, 14, 5, 5, 3, 10, 1, 7, 6, 1, 9, 6, 2, 5, 4, 7, 1, 13, 11, 5, 2, 3, 2, 2, 15, 5, 4, 9, 1, 7, 3, 3, 10, 14, -5, 8, 7, 14, 3, 13, 2, 3, 2, 12, 7, 6, 1, 9, 8, 3, 4, 15, 2, 5, 4, 8, 5, 5, 6, 7, 1, 5, 1, 18, 5, 8, 1, 9, 11, 3, 18
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

Seemingly, the difference sequence is mostly positive. There are special characteristic features, where it is nonpositive (see A091383-A091385).

Crossrefs

Programs

  • PARI
    {/* Difference sequence of the largest "mixed" QR modulo the primes */ d_lqxr(to)=local(v=[],k,r,q,p,e=1); for(i=2,to,p=prime(i);k=p-1;r=p%4-2; while(kronecker(k,p)<>r,k-=1); v=concat(v,k-e);e=k); print(v) }

A248222 Maximal gap between quadratic residues mod n.

Original entry on oeis.org

1, 1, 2, 3, 3, 2, 3, 4, 3, 3, 4, 5, 5, 3, 5, 7, 4, 3, 5, 7, 6, 4, 5, 8, 3, 5, 3, 7, 4, 5, 5, 8, 6, 4, 5, 9, 5, 5, 6, 11, 6, 6, 6, 8, 6, 5, 5, 12, 4, 3, 6, 8, 7, 3, 8, 9, 7, 4, 6, 11, 7, 5, 9, 8, 9, 6, 7, 13, 7, 5, 7, 12, 5, 5, 7, 8, 11, 6, 7, 15, 3, 6, 8, 12, 13, 6, 11, 16, 7, 6
Offset: 1

Views

Author

David W. Wilson and M. F. Hasler, Oct 04 2014

Keywords

Comments

"Maximal gap between squares mod n" would be a less ambiguous definition.
The definition of quadratic residue modulo a nonprime varies from author to author. Sometimes, even when n is a prime, 0 is not counted as a quadratic residue. In this entry, an integer q is called a quadratic residue modulo n if it is congruent to a perfect square modulo n.
See A248376 for the variant with the additional restriction that the residue be coprime to the modulus. - M. F. Hasler, Oct 08 2014

Examples

			For n=7, the quadratic residues are all numbers congruent to 0, 1, 2, or 4 (mod 7), so the largest gap of 3 occurs for example between 4 = 2^2 (mod 7) and 7 = 0^2 (mod 7).
For n=16, the quadratic residues are the numbers congruent to 0, 1, 4 or 9 (mod 16), so the largest gap occurs between, e.g., 9 = 3^2 (mod 16) and 16 = 0^2 (mod 16).
		

References

  • K. Ireland and M. Rosen, A Classical Introduction to Modern Number Theory, Springer, 1982, p. 194. [Requires gcd(q,n)=1 for q to be a quadratic residue mod n.]
  • F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, Elsevier-North Holland, 1978, p. 45.
  • G. B. Mathews, Theory of Numbers, 2nd edition. Chelsea, NY, p. 32. [Does not require gcd(q,n)=1.]
  • Ivan Niven and Herbert S. Zuckerman, An Introduction to the Theory of Numbers, New York: John Wiley, 2nd ed., 1966, p. 69. [Requires gcd(q,n)=1 for q to be a quadratic residue mod n.]
  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 270. [Does not require gcd(q,n)=1.]

Crossrefs

Programs

  • PARI
    (DD(v)=vecextract(v,"^1")-vecextract(v,"^-1")); a(n)=vecmax(DD(select(f->issquare(Mod(f,n)),vector(n*2,i,i))))

Extensions

Comments and references added by N. J. A. Sloane, Oct 04 2014

A248376 Maximal gap between quadratic residues mod n; here quadratic residues must be coprime to n.

Original entry on oeis.org

1, 2, 3, 4, 3, 6, 4, 8, 3, 8, 4, 12, 5, 8, 12, 8, 4, 6, 5, 12, 12, 8, 6, 24, 3, 8, 3, 16, 4, 18, 5, 8, 12, 8, 13, 12, 5, 10, 15, 32, 6, 24, 6, 16, 12, 12, 6, 24, 4, 8, 18, 20, 7, 6, 13, 32, 15, 10, 6, 48, 7, 10, 12, 8, 13, 24, 7, 16, 18, 20, 8, 24, 5, 10
Offset: 1

Views

Author

David W. Wilson and M. F. Hasler, Oct 05 2014

Keywords

Comments

The definition of quadratic residue modulo a nonprime varies from author to author. Sometimes, quadratic residues are not required to be coprime to n, cf. A248222 for the corresponding variant of this sequence.

References

  • K. Ireland and M. Rosen, A Classical Introduction to Modern Number Theory, Springer, 1982, p. 194. [Requires gcd(q,n)=1 for q to be a quadratic residue mod n.]
  • F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, Elsevier-North Holland, 1978, p. 45.
  • G. B. Mathews, Theory of Numbers, 2nd edition. Chelsea, NY, p. 32. [Does not require gcd(q,n)=1.]
  • Ivan Niven and Herbert S. Zuckerman, An Introduction to the Theory of Numbers, New York: John Wiley, 2nd ed., 1966, p. 69. [Requires gcd(q,n)=1 for q to be a quadratic residue mod n.]
  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 270. [Does not require gcd(q,n)=1.]

Crossrefs

Programs

  • PARI
    a(n)={L=m=1;for(i=2,n+1,gcd(i,n)>1&&next;issquare(Mod(i,n))||next;i-L>m&&m=i-L;L=i);m}
Showing 1-9 of 9 results.