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.

A133518 Smallest k such that p(n)^3 + k is prime where p(n) is the n-th prime.

Original entry on oeis.org

3, 2, 2, 4, 30, 6, 6, 4, 30, 2, 12, 18, 6, 24, 14, 14, 12, 10, 16, 2, 6, 4, 2, 14, 54, 6, 4, 18, 4, 2, 30, 26, 56, 10, 24, 12, 24, 10, 30, 2, 18, 6, 26, 24, 14, 28, 18, 10, 14, 10, 12, 24, 16, 6, 18, 2, 20, 6, 4, 12, 4, 6, 10, 2, 6, 14, 16, 4, 18, 10, 14, 14, 16, 24, 4, 12, 32, 16, 50, 12, 2
Offset: 1

Views

Author

Carl R. White, Sep 14 2007

Keywords

Examples

			p(1)=2, 2^3 = 8. for even k, 2^r + k is even and thus not prime, so we only need consider odd k.
for k = 1: 8 + 1 = 9, which is 3^2 and not prime.
for k = 3: 8 + 3 = 11, which is prime, so 3 is the smallest number that can be added to 8 to make a new prime.
Hence a(1) = 3.
		

Crossrefs

Programs

  • Magma
    [NextPrime(p^3)-p^3: p in PrimesUpTo(500)]; // Bruno Berselli, Sep 03 2013
  • Mathematica
    Table[NextPrime[Prime[n]^3] - Prime[n]^3, {n, 100}] (* Bruno Berselli, Sep 03 2013 *)
  • PARI
    a(n) = {k = 0; p3 = prime(n)^3; while (! isprime(p3+k), k++); k;} \\ Michel Marcus, Sep 03 2013
    
  • PARI
    a(n) = {p3 = prime(n)^3; nextprime(p3) - p3;} \\ Michel Marcus, Sep 03 2013