Re: Prime Puzzle with Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg92705] Re: Prime Puzzle with Mathematica
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 11 Oct 2008 06:42:39 -0400 (EDT)
- References: <gcn48r$74t$1@smc.vnet.net>
amzoti schrieb: > 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 > Do you think of sth. like In[1]:= Select[Subsets[Prime[Range[PrimePi[10] + 1, PrimePi[99]]], {3}], And @@ PrimeQ /@ Mean /@ Subsets[#1, {2, 3}] & ] Out[1]= {{11, 47, 71}} ? Look for "Function" and "Select" in the documentation. Peter