Vietnamese snake puzzle - Closed
|
05-20-2015, 09:37 AM
(This post was last modified: 05-20-2015 12:58 PM by Gerald H.)
Post: #1
|
|||
|
|||
Vietnamese snake puzzle - Closed
Order of operations argument or find a solution?
http://www.theguardian.com/science/alexs...d-teachers |
|||
05-20-2015, 11:27 AM
Post: #2
|
|||
|
|||
RE: Vietnamese snake puzzle
(05-20-2015 09:37 AM)Gerald H Wrote: Order of operations argument or find a solution? Quote:multiply first, then division Let's go with argument first, that's more important than solutions. |
|||
05-20-2015, 11:33 AM
(This post was last modified: 05-20-2015 11:34 AM by Gerald H.)
Post: #3
|
|||
|
|||
RE: Vietnamese snake puzzle
Pedantic - me?
Order of operations sort of defined in Guardian text. Two types of action - quibble or solve. |
|||
05-20-2015, 12:58 PM
Post: #4
|
|||
|
|||
RE: Vietnamese snake puzzle
Solvers win - answer found. Quibblers remain confounded.
|
|||
05-20-2015, 01:24 PM
Post: #5
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
Let's assume the 10 variables are named A through I, and that we're doing the standard order of operations here (multiplication and division together from left to right, then addition and subtraction together from left to right).
If we assume that non-integer intermediate results are allowable (e.g. G * H / I can be 1 * 4 / 8), then there are 120 valid solutions (verified via brute force with Heap's algorithm in C# - no, I'm not going to generate 362,880 permutations with a 9-level recursive algorithm on my 48*). If we stipulate that 13 * B / C and G * H / I must have integer results, then there are 20 valid solutions. *Although, there is a 3-day weekend coming up... |
|||
05-20-2015, 01:30 PM
Post: #6
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
Pedantic - me?
A to I traditionally 9 letters & same number of variables. |
|||
05-20-2015, 01:35 PM
Post: #7
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed | |||
05-20-2015, 09:01 PM
(This post was last modified: 05-20-2015 09:08 PM by Gilles.)
Post: #8
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
I wrote a UserRPL program (HP50G) for this.
With the emulator the first solution is found in few minutes. Non-integer intermediate results are allowed. Program still running. 22 solutions found for now. |
|||
05-21-2015, 04:04 AM
Post: #9
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
I've found one solution using paper and pencil only, but I'm not pleased with my work. I assumed all intermediate results are integer. This implies c = 1, because 13 is prime. I didn't figure out any other way than atributing values to three variables (i, b and e) and changing them sequentially as they proved to be impossible. It took no more than an hour and a sheet of paper to find the solution, but that would be too much during an examination though.
No spoiler: a.b.d.e = 120 f.g.h.i = 3024 |
|||
05-21-2015, 05:30 AM
Post: #10
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
(05-21-2015 04:04 AM)Gerson W. Barbosa Wrote: I've found one solution using paper and pencil only, but I'm not pleased with my work. I assumed all intermediate results are integer. This implies c = 1, because 13 is prime. I didn't figure out any other way than atributing values to three variables (i, b and e) and changing them sequentially as they proved to be impossible. It took no more than an hour and a sheet of paper to find the solution, but that would be too much during an examination though. Factors check out as a possibly good solution. |
|||
05-21-2015, 08:12 AM
(This post was last modified: 05-21-2015 08:13 AM by Tugdual.)
Post: #11
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
Since I'm in Haskell at the moment, I gave it a go, it is quite a simple exercise.
For what it matters, I found 128 solutions instantly... wow. Haskell code Code: import Data.List Solutions Code:
|
|||
05-21-2015, 08:41 AM
Post: #12
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
Do you, Tugdual, claim your list of solutions is exhaustive?
|
|||
05-21-2015, 10:51 AM
Post: #13
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed | |||
05-21-2015, 11:21 AM
Post: #14
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed | |||
05-21-2015, 11:53 AM
Post: #15
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed | |||
05-21-2015, 12:02 PM
Post: #16
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
I beg your pardon, Tugdual, I miscounted.
I only expected one solution & was happy when I found one. Bravo on your quick research. |
|||
05-21-2015, 12:19 PM
Post: #17
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed | |||
05-21-2015, 12:29 PM
Post: #18
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
(05-21-2015 12:02 PM)Gerald H Wrote: I beg your pardon, Tugdual, I miscounted.Thanks but no glory, Haskell is quite amazing for that sort of brute force... Now I guess the real fun to stick on the forum topic would be to find a clever solution to do that with a simple calculator. |
|||
05-21-2015, 01:14 PM
Post: #19
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
(05-21-2015 12:29 PM)Tugdual Wrote: Thanks but no glory, Haskell is quite amazing for that sort of brute force... Or maybe somebody brings Haskell to the HP 50g? Cheers Thomas |
|||
05-21-2015, 01:18 PM
(This post was last modified: 05-21-2015 01:23 PM by fhub.)
Post: #20
|
|||
|
|||
RE: Vietnamese snake puzzle - Closed
(05-21-2015 11:53 AM)Tugdual Wrote: I think there are 128 in my list and this is what Haskell returned.Yes, I do expect more. Your list is missing 8 additional solutions (due to rounding errors), there are 136 solutions in total - here the missing 8: 183745269 183745629 269851473 269851743 783145269 783145629 869251473 869251743 If you rewrite your equation (avoiding the 2 divisions by multiplying with the 2 denominators), then your program will give you all 136 solutions. Edit: Or change the test to something like abs(expr-66)<1e-3 ... Franz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)