login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Primes such that the previous prime plus the next prime plus 1 is also prime.
2

%I #16 Mar 08 2020 10:35:35

%S 5,7,13,19,31,37,43,47,53,61,73,79,89,97,137,151,167,173,193,199,223,

%T 229,241,251,271,349,353,367,379,383,409,439,457,463,487,503,521,523,

%U 587,593,619,643,647,653,727,787,797,809,829,853,859,937

%N Primes such that the previous prime plus the next prime plus 1 is also prime.

%H Harvey P. Dale, <a href="/A280266/b280266.txt">Table of n, a(n) for n = 1..1000</a>

%e 5 is in the sequence because 3 + 7 + 1 = 11, which is prime.

%e 7 is in the sequence because 5 + 11 + 1 = 17, which is prime.

%e 11 is not in the sequence because 7 + 13 + 1 = 21, which is not prime.

%t fQ[p_] := PrimeQ[ NextPrime[p, -1] + NextPrime[ p] +1]; Select[ Prime@ Range[2, 170], fQ] (* _Robert G. Wilson v_, Dec 30 2016 *)

%t Select[Partition[Prime[Range[200]],3,1],PrimeQ[#[[1]]+#[[3]]+1]&][[All,2]] (* _Harvey P. Dale_, Dec 16 2018 *)

%o (Sage)

%o max_next_p = 1000

%o seq = []

%o prev_p = nth_prime(1)

%o p = nth_prime(2)

%o for next_p in primes(nth_prime(3), max_next_p):

%o if is_prime(prev_p + next_p + 1):

%o seq.append(p)

%o prev_p = p

%o p = next_p

%o print(seq)

%o (PARI) isok(n) = isprime(n) && isprime(precprime(n-1) + nextprime(n+1) + 1); \\ _Michel Marcus_, Dec 30 2016

%Y Cf. A005384, A005385, A006562.

%K nonn

%O 1,1

%A _Robert C. Lyons_, Dec 30 2016