%I #10 Apr 14 2020 20:12:20
%S 5,7,23,161957,180287,484153,496123,610633,799223,805523,1466747,
%T 1489507,1562983,1857287,2331887,2398223,2550203,2599847,2728703,
%U 3562043,3752093,4094743,4366847,4451743,4914653,5137547,5378497,6305857,6709057,6718763,6797933,6930037
%N Primes p such that both (p-1)*(p-2) and (p+1)*(p+2) are averages of twin prime pairs.
%H Amiram Eldar, <a href="/A173996/b173996.txt">Table of n, a(n) for n = 1..10000</a>
%e 5 is a term since (5-1)*(5-2) = 4*3 = 12 and (5+1)*(5+2) = 6*7 = 42 are averages of the twin prime pairs (11, 13) and (41, 43).
%e 7 is a term since (7-1)*(7-2) = 6*5 = 30 and (7+1)*(7+2) = 8*9 = 72 are averages of the twin prime pairs (29, 31) and (71, 73).
%t f[n_]:=PrimeQ[(n-1)*(n-2)-1]&&PrimeQ[(n-1)*(n-2)+1]&&PrimeQ[(n+1)*(n+2)-1]&&PrimeQ[(n+1)*(n+2)+1];lst={};Do[p=Prime[n];If[f[p],AppendTo[lst,p]],{n,9!}];lst
%t Select[Prime[Range[475000]],AllTrue[{(#-1)(#-2)-1,(#-1)(#-2)+1,(#+1) (#+2)- 1,(#+1)(#+2)+1},PrimeQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Apr 14 2020 *)
%Y Cf. A014574.
%K nonn
%O 1,1
%A _Vladimir Joseph Stephan Orlovsky_, Mar 04 2010
%E More terms from _Amiram Eldar_, Dec 22 2019