Re: Prime Puzzle with Mathematica [CORRECTION]
- To: mathgroup at smc.vnet.net
- Subject: [mg92712] Re: [mg92680] Prime Puzzle with Mathematica [CORRECTION]
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 11 Oct 2008 06:43:59 -0400 (EDT)
- Reply-to: hanlonr at cox.net
This can be written more compactly as Select[Subsets[p, {3}], And @@ PrimeQ /@ Mean /@ Subsets[#, {2, 3}] &] Bob Hanlon ---- Bob Hanlon <hanlonr at cox.net> wrote: ============= p = Table[Prime[i], {i, 5, 25}] {11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97} Select[Subsets[p, {3}], And @@ (PrimeQ /@ (Mean /@ Drop[Subsets[#], 4])) &] {{11, 47, 71}} Bob Hanlon ---- amzoti <amzoti at gmail.com> wrote: ============= Hi All, trying to find an efficient way to this in Mathematica. I found the answer - but it was a manual list manipulation - and it was ugly! Any suggestions? 3 Nice Primes: Find three 2-digit prime numbers such that: * The average of any two of the three is a prime number, and * The average of all three is also a prime number Thanks! ~A -- Bob Hanlon -- Bob Hanlon