%I #60 Sep 08 2022 08:44:47
%S 5,7,11,13,17,23,31,37,41,47,53,61,67,73,83,97,101,103,107,131,151,
%T 157,167,173,191,193,223,227,233,251,257,263,271,277,307,311,331,347,
%U 353,367,373,383,433,443,457,461,503,541,557,563,571,587,593,601,607,613,641,647
%N Primes p such that p + 6 is also prime. (Lesser of a pair of sexy primes.)
%H T. D. Noe, <a href="/A023201/b023201.txt">Table of n, a(n) for n = 1..10000</a>
%H Maxie D. Schmidt, <a href="https://arxiv.org/abs/1701.04741">New Congruences and Finite Difference Equations for Generalized Factorial Functions</a>, arXiv:1701.04741 [math.CO], 2017.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SexyPrimes.html">Sexy Primes</a>. [The definition in this webpage is unsatisfactory, because it defines a "sexy prime" as a pair of primes.- _N. J. A. Sloane_, Mar 07 2021].
%F From _M. F. Hasler_, Jan 02 2020: (Start)
%F a(n) = A046117(n) - 6 = A087695(n) - 3.
%F A023201 = { p = A000040(k) | A000040(k+1) = p+6 or A000040(k+2) = p+6 } = A031924 U A007529. (End)
%p A023201 := proc(n)
%p option remember;
%p if n = 1 then
%p 5;
%p else
%p for a from procname(n-1)+2 by 2 do
%p if isprime(a) and isprime(a+6) then
%p return a;
%p end if;
%p end do:
%p end if;
%p end proc: # _R. J. Mathar_, May 28 2013
%t Select[Range[10^2], PrimeQ[ # ]&&PrimeQ[ #+6] &] (* _Vladimir Joseph Stephan Orlovsky_, Apr 29 2008 *)
%t Select[Prime[Range[120]],PrimeQ[#+6]&] (* _Harvey P. Dale_, Mar 20 2018 *)
%o (Magma) [n: n in [0..40000] | IsPrime(n) and IsPrime(n+6)] // _Vincenzo Librandi_, Aug 04 2010
%o (Haskell)
%o a023201 n = a023201_list !! (n-1)
%o a023201_list = filter ((== 1) . a010051 . (+ 6)) a000040_list
%o -- _Reinhard Zumkeller_, Feb 25 2013
%o (PARI) is(n)=isprime(n+6)&&isprime(n) \\ _Charles R Greathouse IV_, Mar 20 2013
%Y A031924 (primes starting a gap of 6) and A007529 together give this (A023201).
%Y Cf. A046117 (a(n)+6), A087695 (a(n)+3), A098428, A000040, A010051, A006489 (subsequence).
%K nonn,easy
%O 1,1
%A _David W. Wilson_