%I #20 Sep 08 2022 08:46:21
%S 5,11,23,29,149,269,293,347,617,647,683,761,809,1259,1553,1619,2003,
%T 2063,2081,2129,2297,2309,2381,2579,2693,2897,3023,3557,4241,4721,
%U 4799,4817,5519,6197,6719,6833,6959,8237,8537,8597,8783,9029,9461,9677,9929
%N Primes p such that prime(p) + p + 1 and prime(p) - p - 1 are both prime.
%C Subsequence of A317909 and consequently the resulting primes are a subsequence of A112885 (see A317909 for proof).
%H Robert Israel, <a href="/A304372/b304372.txt">Table of n, a(n) for n = 1..10000</a>
%e p=5; prime(5) + 5 + 1 = 17 and prime(5) - 5 - 1 = 5, both prime so 5 is a member, and since the same does not hold for primes 2 and 3, a(1)=5.
%p N:=5000:
%p for X from 1 to N do
%p A:=ithprime(X);
%p P:=A+X+1;
%p Q:=A-X-1;
%p if isprime(X) and isprime(P) and isprime(Q) then print(X);
%p end if:
%p end do:
%t Select[Prime[Range[2 10^3]], And@@PrimeQ[{Prime[#] + # + 1, Prime[#] - # - 1}] &] (* _Vincenzo Librandi_, Aug 18 2018 *)
%o (Magma) [n: n in [1..2*10^4] | IsPrime(n) and IsPrime (NthPrime(n)+n+1) and IsPrime (NthPrime(n)-n-1)]; // _Vincenzo Librandi_, Aug 18 2018
%o (PARI) isok(p) = isprime(p) && isprime(prime(p) + p + 1) && isprime(prime(p) - p - 1); \\ _Michel Marcus_, Aug 18 2018
%Y Cf. A112885, A317909.
%K nonn,easy
%O 1,1
%A _David James Sycamore_, Aug 16 2018
%E More terms from _Vincenzo Librandi_, Aug 18 2018
|