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.

A097523 a(n) = least k such that k - prime(n) and k + prime(n) are both prime.

Original entry on oeis.org

5, 8, 8, 10, 18, 16, 20, 22, 30, 32, 36, 42, 48, 46, 50, 56, 72, 66, 70, 78, 76, 84, 90, 92, 100, 132, 108, 120, 114, 116, 130, 138, 140, 142, 162, 156, 160, 168, 170, 176, 210, 186, 198, 196, 200, 202, 222, 226, 230, 232, 246, 252, 246, 258, 264, 294, 272, 276
Offset: 1

Views

Author

Pierre CAMI, Aug 27 2004

Keywords

Examples

			Prime(10) = 29; both 32 - 29 = 3 and 32 + 29 = 61 are prime, and 32 is the smallest integer for which this is the case, so a(10) = 32.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p, k;
      p:= ithprime(n);
      for k from p+1 by 2 do
        if isprime(k+p) and isprime(k-p) then return k fi
      od
    end proc:
    f(1):= 5:
    map(f, [$1..100]); # Robert Israel, Jul 26 2015
  • Mathematica
    f[n_] := Block[{k = Prime[n], p = Prime[n]}, While[ !PrimeQ[k - p] || !PrimeQ[k + p], k++ ]; k]; Table[ f[n], {n, 60}] (* Robert G. Wilson v, Aug 28 2004 *)

Formula

a(n) = A087711(A000040(n)). - Robert Israel, Jul 26 2015

Extensions

Corrected by Robert G. Wilson v, Aug 28 2004