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.

A057662 Smallest prime q such that q + 2^prime(n) is a prime, where prime(n) is the n-th prime.

Original entry on oeis.org

3, 3, 5, 3, 5, 17, 29, 53, 11, 11, 11, 29, 71, 29, 5, 5, 131, 197, 3, 11, 29, 23, 89, 29, 359, 149, 239, 239, 881, 281, 29, 3449, 197, 683, 389, 683, 101, 1283, 83, 191, 1181, 197, 5, 71, 107, 101, 71, 4001, 1433, 251, 431, 29, 1361, 89, 509, 83, 2459, 941, 101, 197
Offset: 1

Views

Author

Labos Elemer, Oct 16 2000

Keywords

Examples

			For n = 6, prime(6) = 13, 8192 + 17 = 8209 is a prime but 8192 + 2, 8182 + 3, ..., 8192 + 13 are not, so a(6) = 17.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{m = 2^Prime[n], q = 2}, While[!PrimeQ[q + m], q = NextPrime[q]]; q]; Array[a, 60] (* Amiram Eldar, Mar 13 2025 *)
  • PARI
    a(n) = my(P=2^prime(n), q=2); while (!isprime(P+q), q = nextprime(q+1)); q; \\ Michel Marcus, Mar 04 2022

Formula

a(n) = A056206(A000040(n)).