%I #83 Apr 26 2024 11:59:58
%S 2,3,5,7,11,13,17,19,23,29,31,37,41,47,53,59,67,71,83,89,101,107,109,
%T 113,127,131,137,139,149,157,167,179,181,191,197,199,211,227,233,239,
%U 251,257,263,269,281,293,307,311,317,337,347,353,359,379,389,401,409
%N Chen primes: primes p such that p + 2 is either a prime or a semiprime.
%C 43 is the first prime which is not a member (see A102540).
%C Contains A001359 = lesser of twin primes.
%C A063637 is a subsequence. - _Reinhard Zumkeller_, Mar 22 2010
%C In 1966 Chen proved that this sequence is infinite; his proof did not appear until 1973 due to the Cultural Revolution. - _Charles R Greathouse IV_, Jul 12 2016
%C Primes p such that p + 2 is a term of A037143. - _Flávio V. Fernandes_, May 08 2021
%C Named after the Chinese mathematician Chen Jingrun (1933-1996). - _Amiram Eldar_, Jun 10 2021
%H R. J. Mathar, <a href="/A109611/b109611.txt">Table of n, a(n) for n = 1..34076</a>
%H Jing Run Chen, <a href="https://doi.org/10.1142/9789814542487_0019">On the representation of a larger even integer as the sum of a prime and the product of at most two primes</a>, Sci. Sinica 16 (1973), pp. 157-176.
%H Ben Green and Terence Tao, <a href="http://arXiv.org/abs/math/0405581">Restriction theory of the Selberg sieve, with applications</a>, arXiv:math/0405581 [math.NT], 2004-2005, pp. 5, 14, 18-19, 21.
%H Ben Green and Terence Tao, <a href="http://dx.doi.org/10.5802/jtnb.538">Restriction theory of the Selberg sieve, with applications</a>, J. Théor. Nombres Bordeaux, Vol. 18, No. 1 (2006), pp. 147-182.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ChensTheorem.html">Chen's Theorem</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ChenPrime.html">Chen Prime</a>.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Chen_prime">Chen prime</a>.
%H Binbin Zhou, <a href="http://dx.doi.org/10.4064%2Faa138-4-1">The Chen primes contain arbitrarily long arithmetic progressions</a>, Acta Arithmetica, Vol. 138 (2009), pp. 301-315.
%F a(n)+2 = A139690(n).
%F Sum_{n>=1} 1/a(n) converges (Zhou, 2009). - _Amiram Eldar_, Jun 10 2021
%e a(4) = 7 because 7 + 2 = 9 and 9 is a semiprime.
%e a(5) = 11 because 11 + 2 = 13, a prime.
%p A109611 := proc(n)
%p option remember;
%p if n =1 then
%p 2;
%p else
%p a := nextprime(procname(n-1)) ;
%p while true do
%p if isprime(a+2) or numtheory[bigomega](a+2) = 2 then
%p return a;
%p end if;
%p a := nextprime(a) ;
%p end do:
%p end if;
%p end proc: # _R. J. Mathar_, Apr 26 2013
%t semiPrimeQ[x_] := TrueQ[Plus @@ Last /@ FactorInteger[ x ] == 2]; Select[Prime[Range[100]], PrimeQ[ # + 2] || semiPrimeQ[ # + 2] &] (* _Alonso del Arte_, Aug 08 2005 *)
%t SequencePosition[PrimeOmega[Range[500]], {1, _, 1|2}][[All, 1]] (* _Jean-François Alcover_, Feb 10 2018 *)
%o (PARI) isA001358(n)= if( bigomega(n)==2, return(1), return(0) );
%o isA109611(n)={ if( ! isprime(n), return(0), if( isprime(n+2), return(1), return( isA001358(n+2)) ); ); }
%o { n=1; for(i=1,90000, p=prime(i); if( isA109611(p), print(n," ",p); n++; ); ); } \\ _R. J. Mathar_, Aug 20 2006
%o (PARI) list(lim)=my(v=List([2]),semi=List(),L=lim+2,p=3); forprime(q=3,L\3, forprime(r=3,min(L\q,q), listput(semi,q*r))); semi=Set(semi); forprime(q=7,lim, if(setsearch(semi,q+2), listput(v,q))); forprime(q=5,L, if(q-p==2, listput(v,p)); p=q); Set(v) \\ _Charles R Greathouse IV_, Aug 25 2017
%o (Python)
%o from sympy import isprime, primeomega
%o def ok(n): return isprime(n) and (primeomega(n+2) < 3)
%o print(list(filter(ok, range(1, 410)))) # _Michael S. Branicky_, May 08 2021
%Y Union of A001359 and A063637.
%Y Cf. A001358, A112021, A112022, A139689, A269256.
%Y Cf. A037143.
%K nonn
%O 1,1
%A _Paul Muljadi_, Jul 31 2005
%E Corrected by _Alonso del Arte_, Aug 08 2005