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.

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)

A088196 Largest number that is not a quadratic residue modulo prime(n).

Original entry on oeis.org

2, 3, 6, 10, 11, 14, 18, 22, 27, 30, 35, 38, 42, 46, 51, 58, 59, 66, 70, 68, 78, 82, 86, 92, 99, 102, 106, 107, 110, 126, 130, 134, 138, 147, 150, 155, 162, 166, 171, 178, 179, 190, 188, 195, 198, 210, 222, 226, 227, 230, 238, 234, 250, 254, 262, 267, 270, 275, 278
Offset: 2

Views

Author

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

Keywords

Comments

These are sometimes called quadratic non-residues modulo p(n). Denote a(n) by LQnR(p_n).

Crossrefs

Programs

  • PARI
    qnrp(fr,n)= {/* The largest QnR modulo the primes */ local(m,p,fl,jj,j,v=[]); fr=max(fr,2); for(i=fr,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)); print(v)}

A088198 Distance LQnR(p_n) (A088196) from p_n.

Original entry on oeis.org

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

Views

Author

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

Keywords

Comments

The members of the sequence are either 1's or primes (easily provable).

Crossrefs

Programs

  • Mathematica
    qrQ[n_, p_] := Length[ Select[ Table[x^2, {x, 1, Floor[p/2]}], Mod[#, p] == n & , 1]] == 1; LQnR[p_] := Catch[ Do[ If[ !qrQ[k, p], Throw[k]], {k, p-1, 0, -1}]]; a[n_] := (p = Prime[n]; p - LQnR[p]); Table[a[n], {n, 2, 100}] (* Jean-François Alcover, May 14 2012 *)
  • PARI
    qnrp_pm(fr,n)= {/* The distance of primes from the largest QnR modulo the primes */ local(m,p,fl,jj,j,v=[]); fr=max(fr,2); for(i=fr,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,p-m)); print(v)}

Formula

a(n) = prime(n)-LQnR(prime(n)) = A000040(n)-A088196(n), where prime(n) is the n-th prime and LQnR(m) is the largest quadratic non-residue modulo m.

A088200 Members of the difference sequence (A088197) of LQnR(p_n) (A088196) where it is <= 0.

Original entry on oeis.org

-2, -2, -4, -2, -2, -4, -2, -4, -2, 0, -4, -4, -4, -2, -4, -2, -2, -10, -2, -4, 0, -4, -4, -8, -10, -2, -4, 0, -4, -2, -4, -4, -4, -2, -4, 0, -4, -6, -4, 0, -8, -4, -2, -2, 0, -4, -4, -4, -10, -2, -14, -2, 0, 0, -6, -4, -4, 0, -10, -2, 0, -4, -10, -4, -2, 0, -4, -2, -2, -6, -2, -4, 0, -2, -4, -4, -10, -8, -2, 0, 0, -8, -4, -8, -4, 0, -2
Offset: 1

Views

Author

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

Keywords

Comments

The members of the sequence are always even (conjectured!).

Crossrefs

Programs

  • PARI
    qnrp_d_nm(n)= {/* The difference sequence of LQnR 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,m-k)); k=m); print(v)}

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)}

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)}

A091385 Distance (A091382) of primes from the largest quadratic "mixed" residues modulo the primes (A091380), where the latter is non-monotonic.

Original entry on oeis.org

2, 7, 11, 7, 11, 11, 7, 17, 7, 7, 7, 13, 11, 13, 7, 11, 7, 11, 13, 7, 11, 13, 11, 7, 11, 11, 13, 7, 7, 11, 13, 19, 11, 17, 11, 7, 7, 7, 13, 13, 17, 11, 11, 17, 11, 13, 19, 11, 13, 11, 7, 7, 11, 19, 11, 11, 7, 13, 11, 11, 13, 13, 7, 13, 17, 13, 11, 17, 11, 19, 11, 11, 11, 13, 23, 7, 17, 7
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

For n > 1, the values are some odd primes, but never < 7. The maximum value increases very slowly, it only reaches 43 for the first 10^5 primes.

Crossrefs

Programs

  • PARI
    {/* The distance of LQxR from the primes where the sequence of the largest "mixed" QR modulo the primes is non-monotonic */ lqxr_nm_pd(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-k);n+=1);e=k); print(i);print(v) }
Showing 1-7 of 7 results.