Vietnamese snake puzzle - Closed - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Vietnamese snake puzzle - Closed (/thread-3920.html) Pages: 1 2 |
Vietnamese snake puzzle - Closed - Gerald H - 05-20-2015 09:37 AM Order of operations argument or find a solution? http://www.theguardian.com/science/alexs-adventures-in-numberland/2015/may/20/can-you-do-the-maths-puzzle-for-vietnamese-eight-year-olds-that-has-stumped-parents-and-teachers RE: Vietnamese snake puzzle - Dave Britten - 05-20-2015 11:27 AM (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. RE: Vietnamese snake puzzle - Gerald H - 05-20-2015 11:33 AM Pedantic - me? Order of operations sort of defined in Guardian text. Two types of action - quibble or solve. RE: Vietnamese snake puzzle - Gerald H - 05-20-2015 12:58 PM Solvers win - answer found. Quibblers remain confounded. RE: Vietnamese snake puzzle - Closed - Dave Britten - 05-20-2015 01:24 PM 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... RE: Vietnamese snake puzzle - Closed - Gerald H - 05-20-2015 01:30 PM Pedantic - me? A to I traditionally 9 letters & same number of variables. RE: Vietnamese snake puzzle - Closed - Dave Britten - 05-20-2015 01:35 PM (05-20-2015 01:30 PM)Gerald H Wrote: Pedantic - me? Er, yeah, 9 variables, not 10. Us CS guys and our off-by-one errors... RE: Vietnamese snake puzzle - Closed - Gilles - 05-20-2015 09:01 PM 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. RE: Vietnamese snake puzzle - Closed - Gerson W. Barbosa - 05-21-2015 04:04 AM 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 RE: Vietnamese snake puzzle - Closed - Gerald H - 05-21-2015 05:30 AM (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. RE: Vietnamese snake puzzle - Closed - Tugdual - 05-21-2015 08:12 AM 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:
RE: Vietnamese snake puzzle - Closed - Gerald H - 05-21-2015 08:41 AM Do you, Tugdual, claim your list of solutions is exhaustive? RE: Vietnamese snake puzzle - Closed - Tugdual - 05-21-2015 10:51 AM (05-21-2015 08:41 AM)Gerald H Wrote: Do you, Tugdual, claim your list of solutions is exhaustive?Yes I would think so unless my Haskell code is wrong but I checked a few combinations and they look good. RE: Vietnamese snake puzzle - Closed - Gerald H - 05-21-2015 11:21 AM (05-21-2015 10:51 AM)Tugdual Wrote:(05-21-2015 08:41 AM)Gerald H Wrote: Do you, Tugdual, claim your list of solutions is exhaustive?Yes I would think so unless my Haskell code is wrong but I checked a few combinations and they look good. I only see 127 solutions? RE: Vietnamese snake puzzle - Closed - Tugdual - 05-21-2015 11:53 AM (05-21-2015 11:21 AM)Gerald H Wrote:I think there are 128 in my list and this is what Haskell returned.(05-21-2015 10:51 AM)Tugdual Wrote: Yes I would think so unless my Haskell code is wrong but I checked a few combinations and they look good. Do you expect more? RE: Vietnamese snake puzzle - Closed - Gerald H - 05-21-2015 12:02 PM I beg your pardon, Tugdual, I miscounted. I only expected one solution & was happy when I found one. Bravo on your quick research. RE: Vietnamese snake puzzle - Closed - Gerson W. Barbosa - 05-21-2015 12:19 PM (05-21-2015 05:30 AM)Gerald H Wrote:(05-21-2015 04:04 AM)Gerson W. Barbosa Wrote: a.b.d.e = 120 321547986 and all valid commutations thereof. RE: Vietnamese snake puzzle - Closed - Tugdual - 05-21-2015 12:29 PM (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. RE: Vietnamese snake puzzle - Closed - Thomas Klemm - 05-21-2015 01:14 PM (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 RE: Vietnamese snake puzzle - Closed - fhub - 05-21-2015 01:18 PM (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 |