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.

A179295 a(n) is the least prime number such that prime(n)+a(n)+1 is a prime or -1 if no such prime number exists.

Original entry on oeis.org

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

Views

Author

Lars-Erik Svahn, Jun 21 2017

Keywords

Comments

If Maillet's conjecture is true, then a(n) != -1 for all n. - Chai Wah Wu, Aug 01 2017

Examples

			a(1) = 2, since prime(1) + 2 + 1 = 5.
		

Programs

  • Mathematica
    Table[Block[{p=2}, While[!PrimeQ[Prime[n] + p + 1], p=NextPrime[p]]; p],{n, 100}] (* Indranil Ghosh, Jun 30 2017 *)
  • PARI
    a(n) = my(pn=prime(n), p=2); while(! isprime(pn+p+1), p = nextprime(p+1)); p; \\ Michel Marcus, Jun 30 2017
    
  • Python
    from sympy import prime, isprime, nextprime
    def a(n):
        p=2
        while not isprime(prime(n) + p + 1): p=nextprime(p)
        return p
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 30 2017

Extensions

Definition clarified by Chai Wah Wu, Aug 01 2017
More terms from Chai Wah Wu, Aug 02 2017