%I #15 Feb 16 2025 08:33:11
%S 2,2,3,2,3,2,3,3,3,2,3,2,3,3,3,2,3,2,3,3,5,2,3,3,3,3,3,2,3,2,3,3,3,3,
%T 3,2,3,3,5,2,3,2,3,3,3,2,3,5,3,3,5,2,3,3,3,3,5,2,3,2,5,3,3,3,3,2,3,3,
%U 3,2,3,2,3,3,5,3,3,2,3,3,5,2,3,5,3,5,3,2,3,3,3,3,5,3,3,2,3,3,3,2,3,2,3,3,3
%N Smallest prime p such that p + 2n is prime or semiprime.
%C For any even integer h, there exist infinitely many primes p such that p+h is either a prime or a semiprime;
%C A171136(n) = a(n) + 2*n;
%C a(A171137(n))=A000040(n) and a(m)<>A000040(n) for m < A171137(n).
%H R. Zumkeller, <a href="/A171135/b171135.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/ChenPrime.html">Chen Prime</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Chen_prime">Chen prime</a>
%F A010051(a(n)) * (A010051(a(n)+2*n) + A064911(a(n)+2*n)) = 1.
%t spp[n_]:=Module[{p=2},While[PrimeOmega[p+2n]>2,p=NextPrime[p]];p]; Array[ spp,120] (* _Harvey P. Dale_, Sep 25 2018 *)
%o (PARI) a(n)=forprime(p=2,,if(bigomega(p+2*n)<3, return(p))) \\ _Charles R Greathouse IV_, Oct 21 2014
%o (Haskell)
%o a171135 n = head [p | p <- a000040_list, let x = p + 2 * n,
%o a064911 x == 1 || a010051' x == 1]
%o -- _Reinhard Zumkeller_, Oct 21 2014
%Y Cf. A171136, A171137.
%Y Cf. A000040, A010051, A064911.
%K nonn,changed
%O 1,1
%A _Reinhard Zumkeller_, Dec 04 2009