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.

A293271 Numbers n such that n - p and n + p are both prime for some prime p.

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