/* https://medium.com/math-simplified/can-you-really-solve-this-third-grade-math-puzzle-b6c1b7637971 """ Can you really Solve this Third-Grade Math Puzzle? 1 5 2 10 3 55 10 ? """ One thought: 1 -> 5 just given 10 -> 2*1 * 5 - 0 55 -> 3*2 * 10 - 5 ? -> 10*3 * 55 - 10 = 1640 ?? My JGAP Symbplic Regression finds: -2 V2 + 5 V3 + V1 V2 V3 0,0,1,5 1,5,2,10 2,10,3,55 3,55,10,? Solutions: code = (((A * (B * C)) - -5) - B) = [[[0,0,1],5],[[1,5,2],10],[[2,10,3],55]] = [[3,55,10] = 1600] code = ((A * (-5 + (B * C))) - -5) = [[[0,0,1],5],[[1,5,2],10],[[2,10,3],55]] = [[3,55,10] = 1640] ccode = ((B * (B + (-2 - C))) - -5) = [[[0,0,1],5],[[1,5,2],10],[[2,10,3],55]] = [[3,55,10] = 2370] Cf http://hakank.org/jgap/puzzle3.conf */ data(puzzle3,Data,Vars,Unknown,Ops,Constants,MaxC) :- % Data = [ [[1],5], % [[2],10], % [[3],55] % ], Data = [ [[0,0,1],5], [[1,5,2],10], [[2,10,3],55] ], % get_global_map().put("only_first_solution",true), Ops = new_map([infix=["+","-","*"]]), Constants = [-5,-2,2,5], % Speeding up Vars = ["A","B","C"], Unknown = [3,55,10], MaxC = 7.