It felt like I cheated...
September 13, 2007 11:27 AM Subscribe
How do I solve this puzzle mathematically, rather than programmatically?
I condensed it the problem down to the following equation:
And then a ruby permute snippet to solve it:
I got the correct result,
My question is, how can I solve this using pure math, without guessing? Or can I?
I condensed it the problem down to the following equation:
x1 + y1 = z1
x2 - y2 = z2
x3 * y3 = z3
z1 / z2 = y3
And then a ruby permute snippet to solve it:
[1,2,3,4,5,6,7,8,9].permute do |x|
x1 = x[0]
y1 = x[1]
z1 = x[2]
x2 = x[3]
y2 = x[4]
z2 = x[5]
x3 = x[6]
y3 = x[7]
z3 = x[8]
if (x1 + y1 == z1) &&
(x2 - y2 == z2) &&
(x3 * y3 == z3) &&
(z1 / z2 == y3)
then
puts 'x1 = '+x1.to_s
puts 'y1 = '+y1.to_s
puts 'z1 = '+z1.to_s
puts 'x2 = '+x2.to_s
puts 'y2 = '+y2.to_s
puts 'z2 = '+z2.to_s
puts 'x3 = '+x3.to_s
puts 'y3 = '+y3.to_s
puts 'z3 = '+z3.to_s
break;
end
end
I got the correct result,
x1 = 1
y1 = 7
z1 = 8
x2 = 9
y2 = 5
z2 = 4
x3 = 3
y3 = 2
z3 = 6
My question is, how can I solve this using pure math, without guessing? Or can I?
These puzzles are meant to be done not by brute force, as you did above, but by logical reasoning.
For example, its easy to see that z2=2 or 3 or 4. z3 must be 4 or 6 or 8 or 9. And so on, winnowing down the possibilities until you are left with a solution.
posted by vacapinta at 11:37 AM on September 13, 2007
For example, its easy to see that z2=2 or 3 or 4. z3 must be 4 or 6 or 8 or 9. And so on, winnowing down the possibilities until you are left with a solution.
posted by vacapinta at 11:37 AM on September 13, 2007
some additional thoughts-
-z2 has to be 2 or 4 for it to divide something and still get an integer under 9 (3 doesn't work because you can only use it once).
-likewise, y3 has to be 2 or 4.
-so z1 must equal 8.
posted by noloveforned at 11:39 AM on September 13, 2007
-z2 has to be 2 or 4 for it to divide something and still get an integer under 9 (3 doesn't work because you can only use it once).
-likewise, y3 has to be 2 or 4.
-so z1 must equal 8.
posted by noloveforned at 11:39 AM on September 13, 2007
The most obvious starting point to me is that the two numbers that serve as factors in the multiplication problem at the bottom have to be pretty small, otherwise their product is bigger than a single digit. Since you can't repeat a digit - if I understand the rules right - the two factors have to be different, and neither one of them can be a 1. Hence the two factors are 2 and 3 in some order, or 2 and 4 in some order.
Similar reasoning applied to the division problem in the rightmost column says that the bottom two numbers are either 2&3 or 2&4.
That tells you the lower right corner has to be 2, and its two adjacent neighbors (above and to the left) are 3 & 4. Try both possibilities - as soon as you try a possibility you'll be able to fill in the bottom row and right column, with just four squares remaining, which are trivial to analyze.
posted by Wolfdog at 11:39 AM on September 13, 2007
Similar reasoning applied to the division problem in the rightmost column says that the bottom two numbers are either 2&3 or 2&4.
That tells you the lower right corner has to be 2, and its two adjacent neighbors (above and to the left) are 3 & 4. Try both possibilities - as soon as you try a possibility you'll be able to fill in the bottom row and right column, with just four squares remaining, which are trivial to analyze.
posted by Wolfdog at 11:39 AM on September 13, 2007
There's multiple solutions!
(you could swap x1 and y1)
posted by aubilenon at 11:43 AM on September 13, 2007
(you could swap x1 and y1)
posted by aubilenon at 11:43 AM on September 13, 2007
The bottom row only has one combo that results in a number under 10, that isn't itself (3 x 2), so you have 6 3 2; not 6 2 3 (because you cant divide two of the remaining ones to get a 3) and then it's easy peesy
posted by zeoslap at 11:44 AM on September 13, 2007
posted by zeoslap at 11:44 AM on September 13, 2007
What aubilenon said other than yeah, 2 x 4 would fit too :)
posted by zeoslap at 11:45 AM on September 13, 2007
posted by zeoslap at 11:45 AM on September 13, 2007
Best answer: Yes, I figured this out in my head in less than 60 seconds.
Here is how I figured it out :
- Remember the numbers have to be unique.
- The multiplication on the bottom has to be 2 X 3 or 3 x 2. Anything lesser causes duplication, anything bigger will be > 9.
- The multiplication on the bottom has to 3 x 2. Because there is no division (the right hand column) that is possible that will result in 3 without breaking the unique digit rule. 6/2 runs into the other 2 in the multiplication 9/3 duplicates the resulting 3.
- Now that we know the cube looks like this :
? + ? = ?
? - ? = ?
6 = 3 x 2
- There is only one division on the right hand column that gives us 2 without duping numbers 8/4.
? + ? = 8
? - ? = 4
6 = 3 x 2
- From here it was easy to figure out the end is :
7 + 1 = 8
9 - 5 = 4
6 = 3 x 2
posted by ill3 at 11:46 AM on September 13, 2007
Here is how I figured it out :
- Remember the numbers have to be unique.
- The multiplication on the bottom has to be 2 X 3 or 3 x 2. Anything lesser causes duplication, anything bigger will be > 9.
- The multiplication on the bottom has to 3 x 2. Because there is no division (the right hand column) that is possible that will result in 3 without breaking the unique digit rule. 6/2 runs into the other 2 in the multiplication 9/3 duplicates the resulting 3.
- Now that we know the cube looks like this :
? + ? = ?
? - ? = ?
6 = 3 x 2
- There is only one division on the right hand column that gives us 2 without duping numbers 8/4.
? + ? = 8
? - ? = 4
6 = 3 x 2
- From here it was easy to figure out the end is :
7 + 1 = 8
9 - 5 = 4
6 = 3 x 2
posted by ill3 at 11:46 AM on September 13, 2007
You didn't get it right either :) Bottom row is 6 = 3 x 2.. Not 3 = 2 x 6 tut tut tut
posted by zeoslap at 11:47 AM on September 13, 2007
posted by zeoslap at 11:47 AM on September 13, 2007
23skidoo, then you have n1/n2 = 8. There's no solution for this when 0<(n1,n2)<10, n1 != n2
posted by substrate at 12:48 PM on September 13, 2007
posted by substrate at 12:48 PM on September 13, 2007
23skidoo:
z3 can't be 4 because either x3 or z1 would be two digits.
If y3=4 and z3=2, then z2 has to be 3.
The problem with that is finding x2-y2 without duplicating.
posted by MtDewd at 12:49 PM on September 13, 2007
z3 can't be 4 because either x3 or z1 would be two digits.
If y3=4 and z3=2, then z2 has to be 3.
The problem with that is finding x2-y2 without duplicating.
posted by MtDewd at 12:49 PM on September 13, 2007
This thread is closed to new comments.
you can also work at it from ordering the variables - i.e. x1+y1=z1 indicates that z1 > x1 and y1 and so forth. then put them on a number line.
posted by noloveforned at 11:32 AM on September 13, 2007