A177460 Smallest k such that A000217(n)+k and A000217(n)-k are both prime.
0, 1, 3, 2, 2, 9, 5, 2, 12, 5, 5, 12, 2, 7, 27, 4, 8, 9, 13, 2, 24, 5, 7, 12, 2, 5, 27, 4, 2, 75, 19, 38, 18, 11, 7, 30, 2, 7, 9, 2, 16, 63, 7, 4, 12, 25, 5, 12, 16, 35, 51, 2, 2, 9, 13, 16, 12, 17, 41, 60, 20, 13, 51, 8, 32, 9, 5, 22, 18, 35, 19, 12, 22, 7, 75, 34, 2, 93, 11, 2, 30, 25, 11
Offset: 2
Keywords
Examples
3+-0->primes. 6+-1->primes. 10+-3->primes. 15+-2->primes,..
Programs
-
Mathematica
f[n_]:=Block[{k},If[OddQ[n],k=0,k=1];While[ !PrimeQ[n-k]||!PrimeQ[n+k], k+=2];k]; Table[f[n*(n+1)/2],{n,2,5!}]
Extensions
Definition rephrased and offset adapted by R. J. Mathar, Aug 15 2010