Re: Playing with numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg50162] Re: Playing with numbers
- From: kzhang at flashmail.com (Kezhao Zhang)
- Date: Wed, 18 Aug 2004 01:20:14 -0400 (EDT)
- References: <cfshq3$9qf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Thomas Manz" <thomasmanz at web.de> wrote in message news:<cfshq3$9qf$1 at smc.vnet.net>...
> Hello!
>
> Everyone of you knows number riddles! Here´s an example:
> you have five equations:
> (1) H - F = I
> (2) F x G = C
> (3) E / B = F
> (4) A + B = H
> (5) C - D = A
> every variable from A to I stands for a number from 1 to 9, where each number appears only once (no two variables can have the same value)!!
>
> Solving this problem with a piece of paper and your brain should take not more than 10 minutes.
> (I tried it, and also found that 5-4-6-1-8-2-3-9-7 (A-I) is the ONLY solution!)
>
> But how can I solve it with Mathematica??
>
> best regards
> Thomas
Here is a way to solve it by brute force:
p=Permutations[Range[9]];
loc=Position[(And[h -
f == i, f g == c, e/b == f, a + b == h, c - d == a] /. Thread[{a, b, c, d,
e, f, g, h, i} -> #]) & /@ p, True];
p[[loc[[1,1]]]
Indeed, there is only one solution.
K. Z.