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.

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

A088201 Distance p_n-LQnR(p_n) (A088198) where the difference sequence (A088197) of LQnR(p_n) (A088196) is <= 0.

Original entry on oeis.org

5, 5, 7, 5, 5, 7, 5, 11, 5, 11, 7, 7, 7, 5, 7, 5, 5, 13, 5, 7, 11, 7, 7, 11, 13, 5, 7, 11, 7, 5, 11, 7, 7, 5, 7, 7, 7, 13, 7, 7, 11, 7, 5, 5, 11, 7, 7, 7, 13, 13, 17, 5, 11, 11, 17, 11, 7, 7, 13, 5, 7, 7, 13, 7, 5, 7, 7, 5, 5, 13, 5, 7, 11, 13, 7, 7, 17, 11, 5, 7, 11, 11, 7, 11, 7, 7, 5, 7
Offset: 1

Views

Author

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

Keywords

Comments

The terms are conjectured to be odd primes > 3.
It is also conjectured that the i-th member of A088200 is -2 if and only if a(i) is 5.
The terms are conjectured to be odd primes > 3 (the primality is provable).

Crossrefs

Programs

  • PARI
    qnrp_pm_nm(n)= {/* The distance of p from 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,p-m)); k=m); print(v)}

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)

A091380 Largest quadratic "mixed" residue modulo the n-th prime (LQxR(p_n)).

Original entry on oeis.org

1, 1, 3, 4, 9, 11, 14, 17, 18, 27, 28, 35, 38, 41, 42, 51, 57, 59, 65, 76, 81, 86, 92, 99, 100, 105, 107, 110, 124, 129, 134, 137, 147, 148, 155, 161, 162, 171, 177, 179, 184, 188, 195, 196, 209, 220, 225, 227, 230, 232, 234, 249, 254, 258, 267, 268, 275, 278, 281
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

Due to the quadratic reciprocity (Euler's criterion), if a prime p is congruent to 1 mod 4, then (p-1) is a quadratic residue mod p (see A088190). Also, if p is congruent -1 mod 4 then p-1 is a quadratic non-residue mod p (see A088196). This sequence is created in such a way that when p is not congruent to 1 mod 4 then the largest quadratic residue is taken, otherwise the largest quadratic non-residue taken modulo p. Thus it is a merger of A088190 and A088196 by skipping the "trivial" terms. Important observations (tested up to 10^5 primes): - the sequence of largest "mixed" residues modulo the primes (denoted by LQxR(p_n)) is 'almost' monotonic, - for n>1, p_n-LQxR(p_n) is a prime value (see A091382) - if LQxR(p_n)<=LQxR(p_{n-1}) then p_n==+-1 mod 8 (when n>2) (see A091384) - if LQxR(p_n)<=LQxR(p_{n-1}) then p_n-LQxR(p_n) is a prime q>5 (see A091385).

References

  • H. Cohn, Advanced Number Theory, p. 19, Dover Publishing (1962)

Crossrefs

Programs

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

Formula

a(1)=1; a(n>1)=max{r

A091384 Members of the difference sequence (A091381) of the sequence of largest quadratic "mixed" residues modulo the primes (A091380) where the latter is non-monotonic.

Original entry on oeis.org

0, -1, -5, -1, -3, 0, 0, -8, 0, -1, 0, -7, -2, -6, -1, 0, 0, -5, -6, 0, 0, -7, -2, 0, -2, -3, -1, 0, -1, -5, -5, -7, -2, -11, 0, -1, 0, 0, -1, -2, -10, 0, 0, -6, -3, -1, -5, -5, -6, -5, 0, -1, -5, -7, -2, -5, -1, -5, 0, -2, -2, -7, 0, -7, -9, -4, -4, -8, -5, -13, 0, -4, -4, -7, -17, 0, -3, 0, -5, -1, -3, 0, -17, 0, -7, -6, -1, -2, -3, -3, 0
Offset: 1

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

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

Programs

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

A354974 Distance LQnR(n) (A334819) from n.

Original entry on oeis.org

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

Author

Joel Brennan, Jun 14 2022

Keywords

Comments

a(n) is the distance between n and the largest quadratic nonresidue modulo n: a(n) = n - A334819(n). So n - a(n) is the largest nonsquare modulo n.

Examples

			The nonsquares modulo 8 are 2, 3, 5, 6, and 7, so the distance of the largest quadratic nonresidue from 8 is a(8) = 1. The quadratic nonresidues modulo 17 are 3, 5, 6, 7, 10, 11, 12, and 14, so a(17) = 17 - 14 = 3.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := n - Max @ Complement[Range[n - 1], Mod[Range[n/2]^2, n]]; Array[a, 100, 3] (* Amiram Eldar, Jun 15 2022 *)
  • PARI
    a(n) = forstep(r = n - 1, 1, -1, if(!issquare(Mod(r, n)), return(n-r))) \\ Thomas Scheuerle, Jun 15 2022
Showing 1-9 of 9 results.