A177462 Smallest k such that A000125(n)+k and A000125(n)-k are both prime.
1, 3, 2, 3, 1, 3, 4, 21, 3, 9, 18, 5, 9, 55, 36, 5, 21, 57, 30, 9, 7, 21, 14, 33, 49, 3, 150, 39, 117, 19, 12, 11, 27, 17, 66, 27, 21, 87, 10, 75, 7, 21, 14, 33, 39, 45, 30, 47, 3, 5, 210, 49, 27, 3, 30, 63, 5, 21, 58, 69, 5, 9, 168, 153, 9, 37, 204, 23, 33, 41, 78, 21, 123, 3, 100
Offset: 2
Keywords
Examples
4+-1->primes. 8+-3->primes. 15+-2->primes. 26+-3->primes,..
Programs
-
Mathematica
g[n_]:=(n+1)*(n^2-n+6)/6; f[n_]:=Block[{k},If[OddQ[n],k=2,k=1];While[ !PrimeQ[n-k]||!PrimeQ[n+k],k+=2];k]; Table[f[g[n]],{n,2,5!}]
Extensions
Definition rephrased and offset adapted by R. J. Mathar, Aug 15 2010