%I #14 Oct 18 2017 21:46:06
%S 5,8,9,10,12,14,15,16,18,20,21,22,24,26,30,32,34,36,39,40,42,44,45,46,
%T 48,50,54,56,60,64,66,69,70,72,76,78,81,84,86,90,92,96,99,100,102,104,
%U 105,106,108,110,111,114,116,120,126,129,130,132,134,138,140,142
%N Numbers n such that n - p and n + p are both prime for some prime p.
%C Apart from a(1), all terms are composite.
%C Union of A087679 and 2*A063713. - _Robert Israel_, Oct 09 2017
%p filter:= proc(n) local k;
%p k:= 1;
%p while k < n do
%p k:= nextprime(k);
%p if isprime(n+k) and isprime(n-k) then return true fi
%p od;
%p false
%p end proc:
%p select(filter, [$1..1000]); # _Robert Israel_, Oct 09 2017
%t Select[Range@ 142, Function[n, AnyTrue[Prime@ Range@ PrimePi@ n, PrimeQ[n + {-#, #}] == {True, True} &]]] (* _Michael De Vlieger_, Oct 09 2017 *)
%o (PARI) a(n) = forprime(p=1, n, i=n-p; j=n+p; if(isprime(i)&&isprime(j), n; break))
%Y Cf. A087679, A087695, A087696, A087697 (subsequences).
%Y Cf. A063713.
%K nonn
%O 1,1
%A _Gionata Neri_, Oct 04 2017