OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
P:= select(isprime, {seq(i, i=3..10^7, 2)}):
A14574:= sort(convert(map(`+`, P, 1) intersect map(`+`, P, -1), list)):
f:= proc(n) local k, v, kv;
v:= A14574[n]:
for k from 2 do
kv:= k*v;
if kv > 10^7 then if isprime(kv-1) and isprime(kv+1) then return k fi
elif member(kv, A14574) then return k
fi
od
end proc:
map(f, [$1..100]); # Robert Israel, Dec 17 2020
MATHEMATICA
twinMidQ[n_] := AllTrue[{-1, 1} + n, PrimeQ]; f[n_] := Module[{k = 2}, While[! twinMidQ[k*n], k++]; k]; f /@ Select[Range[10^3], twinMidQ] (* Amiram Eldar, Jul 05 2019 *)
PROG
(PARI) isok2(n) = isprime(n-1) && isprime(n+1);
k(n) = my(k=2); while (! isok2(n*k), k++); k;
lista(nn) = for (n=1, nn, if (isok2(n), print1(k(n), ", "))); \\ Michel Marcus, Apr 28 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Dmitry Kamenetsky, Apr 28 2019
STATUS
approved