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.

This page as a plain text file.
%I A097523 #17 Jul 28 2015 22:53:09
%S A097523 5,8,8,10,18,16,20,22,30,32,36,42,48,46,50,56,72,66,70,78,76,84,90,92,
%T A097523 100,132,108,120,114,116,130,138,140,142,162,156,160,168,170,176,210,
%U A097523 186,198,196,200,202,222,226,230,232,246,252,246,258,264,294,272,276
%N A097523 a(n) = least k such that k - prime(n) and k + prime(n) are both prime.
%H A097523 Pierre CAMI, <a href="/A097523/b097523.txt">Table of n, a(n) for n = 1..10000</a>
%F A097523 a(n) = A087711(A000040(n)). - _Robert Israel_, Jul 26 2015
%e A097523 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.
%p A097523 f:= proc(n) local p, k;
%p A097523   p:= ithprime(n);
%p A097523   for k from p+1 by 2 do
%p A097523     if isprime(k+p) and isprime(k-p) then return k fi
%p A097523   od
%p A097523 end proc:
%p A097523 f(1):= 5:
%p A097523 map(f, [$1..100]); # _Robert Israel_, Jul 26 2015
%t A097523 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 *)
%Y A097523 Cf. A000040, A087711.
%K A097523 easy,nonn
%O A097523 1,1
%A A097523 _Pierre CAMI_, Aug 27 2004
%E A097523 Corrected by _Robert G. Wilson v_, Aug 28 2004