RE: Prime Puzzle with Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg92732] RE: [mg92680] Prime Puzzle with Mathematica
- From: "Tony Harker" <a.harker at ucl.ac.uk>
- Date: Sat, 11 Oct 2008 06:47:36 -0400 (EDT)
- References: <200810100835.EAA07106@smc.vnet.net>
]-> -----Original Message----- ]-> From: amzoti [mailto:amzoti at gmail.com] ]-> Sent: 10 October 2008 09:35 ]-> To: mathgroup at smc.vnet.net ]-> Subject: [mg92680] Prime Puzzle with Mathematica ]-> ]-> 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 ]-> ]-> Here's a brute force method: Select[Union[Map[Sort, Flatten[Outer[List, #, #, #], 2]]] &[ Select[Range[10, 99], PrimeQ]], (Length[Union[#]] == 3) && PrimeQ[(#[[1]] + #[[2]])/2] && PrimeQ[(#[[2]] + #[[3]])/2] && PrimeQ[(#[[3]] + #[[1]])/2] && PrimeQ[(#[[1]] + #[[2]] + #[[3]])/3] &] Tony
- References:
- Prime Puzzle with Mathematica
- From: amzoti <amzoti@gmail.com>
- Prime Puzzle with Mathematica