%I #29 Sep 08 2022 08:44:56
%S 7,17,31,47,67,97,101,151,167,227,257,271,347,367,557,587,607,647,727,
%T 941,971,1097,1117,1181,1217,1277,1291,1361,1427,1447,1487,1607,1657,
%U 1747,1777,1867,1901,1987,2131,2281,2377,2411,2677,2687,2707,2791,2897,2957
%N Smallest member of a sexy prime triple: value of p such that p, p+6 and p+12 are all prime, but p+18 is not (although p-6 might be).
%C p-6 will be prime if the prime triple contains the last 3 primes of a sexy prime quadruple.
%C If a sexy prime triple happens to include the last 3 members of a sexy prime quadruple, this sequence will contain the sexy prime triple's smallest member; e.g., a(4)=47 is the smallest member of the sexy prime triple (47, 53, 59), but is also the second member of the sexy prime quadruple (41, 47, 53, 59). - _Daniel Forgues_, Aug 05 2009
%H Eric M. Schmidt, <a href="/A046118/b046118.txt">Table of n, a(n) for n = 1..1000</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].
%t lst={};Do[p=Prime[n];If[PrimeQ[p+6]&&PrimeQ[p+12]&&!PrimeQ[p+18], AppendTo[lst, p]], {n, 7!}];lst (* _Vladimir Joseph Stephan Orlovsky_, Aug 29 2008 *)
%t Select[Prime[Range[500]],AllTrue[#+{6,12},PrimeQ]&&CompositeQ[#+18]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, May 11 2019 *)
%o (PARI) lista(nn) = forprime(p=3, nn, if (isprime(p+6) && isprime(p+12) && !isprime(p+18), print1(p, ", "));); \\ _Michel Marcus_, Jan 06 2015
%o (Magma) [p: p in PrimesUpTo(5000) | not IsPrime(p+18) and IsPrime(p+6) and IsPrime(p+12)]; // _Vincenzo Librandi_, Sep 07 2017
%Y Cf. A023201, A046117.
%Y Cf. A046119, A046120.
%K nonn
%O 1,1
%A _Eric W. Weisstein_
%E Definition edited by _Daniel Forgues_, Aug 12 2009
%E More terms from _Eric M. Schmidt_, Sep 07 2017