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

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)

A088191 First differences of A088190.

Original entry on oeis.org

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

Views

Author

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

Keywords

Comments

Seemingly the difference sequence is mostly positive. There are special characteristic features where it is nonpositive. (See A088193-A088195.)

Crossrefs

Programs

  • PARI
    qrp_d(to)= {/* Difference sequence of the largest QR modulo the primes */ 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
    				

A088199 Primes where the difference sequence (A088197) of LQnR(p_n) (A088196) is <= 0.

Original entry on oeis.org

73, 193, 241, 313, 433, 601, 1033, 1129, 1153, 1201, 1321, 1489, 1609, 1873, 2089, 2113, 2593, 2689, 2713, 3001, 3049, 3121, 3169, 3361, 3529, 3673, 3769, 3889, 4129, 4273, 4729, 4801, 4969, 5233, 5281, 5449, 5521, 5569, 5641, 5689, 5881, 6361, 6553
Offset: 1

Views

Author

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

Keywords

Comments

The members of the sequence are always == 1 modulo 8 (conjectured!).

Crossrefs

Programs

  • PARI
    qnrp_p_nm(n)= {/* The primes where the sequence of the largest QnR modulo the primes is nonmonotonic */ local(k=1,m,p,fl,jj,j,v=[]); for(i=2,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--); if(m-k<=0,v=concat(v,p)); k=m); print(v)}

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
    				

A091383 Prime numbers where the sequence of largest quadratic "mixed" residues modulo the primes (A091380) 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)

Keywords

Comments

All of these primes belong to the +-1 least absolute reside classes modulo 8. (Tested for 10^5 primes.)
Where does this first differ from A088193 (if at all)? - R. J. Mathar, Aug 27 2025

Crossrefs

Programs

  • PARI
    {/* The primes where the sequence of the largest "mixed" QR modulo the primes is non-monotonic */ lqxr_nm_p(to)=local(v=[],k,r,q,p,e=1,n=0,i=1); while(nr,k-=1); if(k-e<=0,v=concat(v,p);n+=1);e=k); print(i);print(v) }
Showing 1-7 of 7 results.