/* https://puzzles9.com/puzzles/number-sequence-puzzles-with-answers/ Puz250 """ 3 11 19 5 ? 23 7 17 29 """ * Representation 2, we rearrange the rows and columns: 3 19 11 7 29 17 5 23 ? [program = B - (5 + A),res = 13,count = 26] [program = B - A - 5,res = 13,count = 22] [program = B * 1 - (5 + A),res = 13,count = 21] [program = B - 5 - A,res = 13,count = 17] [program = B - (A + 5),res = 13,count = 17] I.e. (in the original form): 3+5 + 11 = 19 5+5 + 13 = 23 7+5 + 17 = 29 * Representation 2 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,MaxSize,Params) :- Data = [ [[3,19],11], [[7,29],17] ], Ops = ['+','-','*'], Vars = ['A','B'], Unknown = [5,23], Constants = 1..10, MaxSize = 3, Params = new_map([num_gens=30]). /* Representation 2, transposing the matrix: 3 7 5 19 29 23 11 17 ? gives anoter solution: [program = (B - A) * 3 - 7,res = 11,count = 1] [program = 4 - 3 + (B - 2) + 2 * B - (6 + 3 * A),res = 11,count = 1] [program = B * 3 - (A * 3 + 7),res = 11,count = 1] (3 * ( 7- 3)) - 7 = 5 (3 * (29-19)) - 7 = 23 (3 * (17-11)) - 7 = 11 */ data(puz250,Data,Vars,Unknown,Ops,Constants,MaxSize,Params) :- Data = [ [[3,7],5], [[19,29],23] ], Ops = [+,-,*], Vars = ['A','B'], Unknown = [11,17], Constants = 1..10, MaxSize = 21, Params = new_map().