Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Prime Puzzle with Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92708] Re: Prime Puzzle with Mathematica
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 11 Oct 2008 06:43:15 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <gcn48r$74t$1@smc.vnet.net>

amzoti wrote:

> 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


Select[Subsets[Table[Prime[n], {n, 5, 25}], {3}],
  PrimeQ[1/3
      Plus @@ #] && (And @@ (PrimeQ[1/2 Plus @@@ Subsets[#, {2}]])) &]

The above expression returns the unique solution to the problem 
(assuming I have correctly understood it, of course :-)

Regards,
-- Jean-Marc



  • Prev by Date: Re: Prime Puzzle with Mathematica
  • Next by Date: FindFit
  • Previous by thread: Re: Prime Puzzle with Mathematica
  • Next by thread: Re: Prime Puzzle with Mathematica