%I #17 Apr 03 2023 10:36:13
%S 5,7,17,19,7,11,13,23,7,13,17,23,5,13,19,29,5,11,13,43,11,13,19,29,5,
%T 7,19,47,5,17,19,37,7,11,19,41,11,17,19,31,5,11,31,37,5,13,23,43,11,
%U 13,17,43,11,13,23,37,13,17,23,31,7,11,19,53,7,11,29,43
%N Sets of four primes such that the sum of any three is prime, ordered first by sum, then lexicographically.
%H T. D. Noe, <a href="/A224070/b224070.txt">Table of n, a(n) for n = 1..4000</a>
%H Chris Caldwell and G. L. Honaker, Jr., <a href="https://t5k.org/curios/page.php?curio_id=25883">Prime Curios!</a>
%e The first four terms of the sequence are 5, 7, 17, 19. The sum of any three is prime: 5 + 7 + 17 = 29, 5 + 7 + 19 = 31, 5 + 17 + 19 = 41, 7 + 17 + 19 = 43. This set of four primes has the smallest possible sum, 48, and is unique.
%e There are two such sets of four primes with sum 72: {5, 11, 13, 43} and {11, 13, 19, 29}. The first set is listed first since it is lexicographically earliest.
%t MaxSum = 100; nn = PrimePi[MaxSum - 15]; ps = {}; Do[p = Prime[{a, b, c, d}]; If[Total[p] <= MaxSum, AppendTo[ps, p]], {a, 2, nn - 3}, {b, a + 1, nn - 2}, {c, b + 1, nn - 1}, {d, c + 1, nn}]; s = Select[ps, And @@ PrimeQ /@ (Total[#] - #) &]; s2 = SortBy[s, Total]; Flatten[s2] (* _T. D. Noe_, Apr 01 2013 *)
%Y Cf. A000040.
%K nonn
%O 1,1
%A _G. L. Honaker, Jr._, Mar 30 2013
|