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.

A204894 Least prime p such that n divides p-q for some prime q

Original entry on oeis.org

3, 5, 5, 7, 7, 11, 17, 11, 11, 13, 13, 17, 29, 17, 17, 19, 19, 23, 41, 23, 23, 29, 53, 29, 53, 29, 29, 31, 31, 37, 67, 37, 71, 37, 37, 41, 79, 41, 41, 43, 43, 47, 89, 47, 47, 53, 97, 53, 101, 53, 53, 59, 109, 59, 113, 59, 59, 61, 61, 67, 127, 67, 131, 67, 67, 71
Offset: 1

Views

Author

Clark Kimberling, Jan 20 2012

Keywords

Comments

For a guide to related sequences, see A204892.

Crossrefs

Programs

  • Mathematica
    (See the program at A204892.)
  • PARI
    a(n)=forprime(p=n+2, , forstep(k=p%n, p-1, n, if(isprime(k), return(p)))) \\ Charles R Greathouse IV, Mar 20 2013
    
  • PARI
    a(n)=if(isprime(n+2),return(n+2)); my(s=if(n%2,2*n,n),t); forprime(p=s+3,, t=p%n; forstep(q=if(t%2,t,t+n),p-s,s,if(isprime(q), return(p)))) \\ Charles R Greathouse IV, Jul 17 2015
    
  • PARI
    a(n)=if(isprime(n+2),return(n+2)); my(s=if(n%2,2*n,n),r); forprime(p=s+3,2*s+1, if(isprime(p-s), return(p))); forprime(p=2*s+3,, r=p%n; forstep(q=if(r%2,r,r+n),p-s,s,if(isprime(q), return(p)))) \\ Charles R Greathouse IV, Aug 31 2024

Formula

n + 2 <= a(n) <= prime(n+1). - Charles R Greathouse IV, Jul 17 2015
Haddad, Leung, & Sabuncu prove that a(n) < 270*n for all large n. Probably this holds for all n. - Charles R Greathouse IV, Aug 29 2024