Re: Programming Probability of puzzle in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg44946] Re: Programming Probability of puzzle in Mathematica
- From: Bill Rowe <readnews at earthlink.net>
- Date: Wed, 10 Dec 2003 04:01:51 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 12/9/03 at 3:32 AM, drbob at bigfoot.com (Bobby R. Treat) wrote: > I get a very different result for the following: > Count[Flatten@KSubsets[Range@9,3],#]&/@Range@9 My mistake, this should have been Count[Flatten@Select[KSubsets[Range@9,3],Tr@#==15&],#]&/@Range since it is only the subsets that sum to 15 that are desired. As for why this result implies the digit 5 must be in the center square, for a 3 X 3 magic square the center number appears in 4 sums, both diagonals, the center row and center column. Since 5 is the only digit that appears in 4 of the subsets that sum to 15 it is clear it must be in the center square. One other comment. I interpreted the original problem statement as requiring each digit to appear only once. I see on re-reading it, the intent may have been to allow each digit to appear more than once in the same magic square. Under this assumption, your observation there are 9^9 possible squares is correct, rather than my 9!. But either way, the probability of finding a magic square in a sample of 1000 randomly generated arrays is essentially zero.