/* https://puzzles9.com/puzzles/number-sequence-puzzles-with-answers/ Puz250 """ 3 11 19 5 ? 23 7 17 29 """ And we rearrange the rows and columns: 3 19 11 7 29 17 5 23 ? maxCount = 3 code = ((B - 5) - A) = [[[3,19],11],[[7,29],17]] = [[5,23] = 13] I.e. (in the original form): 3+5 + 11 = 19 5+5 + 13 = 23 7+5 + 17 = 29 There is another solution which also gives 13: The given numbers are primes (ordered columnwise), and the missing number is 13. And the intended solution happens to be this last one (enumerated primes): """ Answer : 13 In the above puzzle, numbers are consecutive prime numbers in each column. First column : 3, 5, 7 Second column: 11, 13, 17 Third column : 19, 23, 29 So, answer is 13. """ */ data(puz250,Data,Vars,Unknown,Ops,Constants,MaxC) :- Data = [ [[3,19],11], [[7,29],17] ], Ops = new_map([infix=["+","-","*"] ]), Vars = ["A","B"], Unknown = [5,23], Constants = 1..10, MaxC = 3. /* Transposing the matrix: 3 7 5 19 29 23 11 17 ? gives anoter solution: maxCount = 5 code = ((3 * (B - A)) - 7) = [[[3,7],5],[[19,29],23]] = [[11,17] = 11] (3 * ( 7- 3)) - 7 = 5 (3 * (29-19)) - 7 = 23 (3 * (17-11)) - 7 = 11 */ data(puz250,Data,Vars,Unknown,Ops,Constants,MaxC) :- Data = [ [[3,7],5], [[19,29],23] ], Ops = new_map([infix=["+","-","*"] ]), Vars = ["A","B"], Unknown = [11,17], Constants = 1..10, MaxC = 6.