08-Jan-2022 22:02:25 polyomino_parity_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test polyomino_parity(). addmultisteps_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 [ num, no_sums, s ] = addmultisteps ( p, ns, steps ) input: P is the parity of the region. NS is a vector of step counts. STEPS is a vector of step sizes. output: NUM is the number of sums equal to P. NO_SUMS is the number of sums generated. S, contains every sum computed. For this example: P = 0 NS = [ 2, 5, 3, 6, 7 ] STEPS = [ 1, 3, 2, 5, 9 ] 56 sums equal to P were found: Correct number of such sums is 56 4032 sums were generated: For this example: P = 4 NS = [ 1, 1, 3 ] STEPS = [ 1, 3, 4 ] 0 sums equal to P were found: Correct number of such sums is 0 16 sums were generated: For this example: P = 4 NS = [ 3, 1, 1 ] STEPS = [ 1, 3, 4 ] 2 sums equal to P were found: Correct number of such sums is 2 16 sums were generated: diophantine_nd_nonnegative_test() MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 diophantine_nd_nonnegative() returns nonnegative solutions of a Diophantine equation in N variables. 2*x1+3*x2 = 18 4 solutions found. 1: 2*0+3*6 = 18 2: 2*3+3*4 = 18 3: 2*6+3*2 = 18 4: 2*9+3*0 = 18 6*x1+3*x2+13*x3 = 16 1 solutions found. 1: 6*0+3*1+13*1 = 16 12*x1+9*x2+7*x3 = 60 4 solutions found. 1: 12*0+9*2+7*6 = 60 2: 12*1+9*3+7*3 = 60 3: 12*2+9*4+7*0 = 60 4: 12*5+9*0+7*0 = 60 2*x1+3*x2+5*x3+6*x4 = 24 31 solutions found. 1: 2*0+3*0+5*0+6*4 = 24 2: 2*0+3*1+5*3+6*1 = 24 3: 2*0+3*2+5*0+6*3 = 24 4: 2*0+3*3+5*3+6*0 = 24 5: 2*0+3*4+5*0+6*2 = 24 6: 2*0+3*6+5*0+6*1 = 24 7: 2*0+3*8+5*0+6*0 = 24 8: 2*1+3*0+5*2+6*2 = 24 9: 2*1+3*2+5*2+6*1 = 24 10: 2*1+3*4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: 2*4+3*9+5*0+6*0+7*0 = 35 96: 2*5+3*0+5*0+6*3+7*1 = 35 97: 2*5+3*0+5*1+6*1+7*2 = 35 98: 2*5+3*0+5*5+6*0+7*0 = 35 99: 2*5+3*1+5*2+6*2+7*0 = 35 100: 2*5+3*1+5*3+6*0+7*1 = 35 101: 2*5+3*2+5*0+6*2+7*1 = 35 102: 2*5+3*2+5*1+6*0+7*2 = 35 103: 2*5+3*3+5*2+6*1+7*0 = 35 104: 2*5+3*4+5*0+6*1+7*1 = 35 105: 2*5+3*5+5*2+6*0+7*0 = 35 106: 2*5+3*6+5*0+6*0+7*1 = 35 107: 2*6+3*0+5*1+6*3+7*0 = 35 108: 2*6+3*0+5*2+6*1+7*1 = 35 109: 2*6+3*1+5*0+6*1+7*2 = 35 110: 2*6+3*1+5*4+6*0+7*0 = 35 111: 2*6+3*2+5*1+6*2+7*0 = 35 112: 2*6+3*2+5*2+6*0+7*1 = 35 113: 2*6+3*3+5*0+6*0+7*2 = 35 114: 2*6+3*4+5*1+6*1+7*0 = 35 115: 2*6+3*6+5*1+6*0+7*0 = 35 116: 2*7+3*0+5*0+6*0+7*3 = 35 117: 2*7+3*0+5*3+6*1+7*0 = 35 118: 2*7+3*1+5*0+6*3+7*0 = 35 119: 2*7+3*1+5*1+6*1+7*1 = 35 120: 2*7+3*2+5*3+6*0+7*0 = 35 121: 2*7+3*3+5*0+6*2+7*0 = 35 122: 2*7+3*3+5*1+6*0+7*1 = 35 123: 2*7+3*5+5*0+6*1+7*0 = 35 124: 2*7+3*7+5*0+6*0+7*0 = 35 125: 2*8+3*0+5*0+6*2+7*1 = 35 126: 2*8+3*0+5*1+6*0+7*2 = 35 127: 2*8+3*1+5*2+6*1+7*0 = 35 128: 2*8+3*2+5*0+6*1+7*1 = 35 129: 2*8+3*3+5*2+6*0+7*0 = 35 130: 2*8+3*4+5*0+6*0+7*1 = 35 131: 2*9+3*0+5*1+6*2+7*0 = 35 132: 2*9+3*0+5*2+6*0+7*1 = 35 133: 2*9+3*1+5*0+6*0+7*2 = 35 134: 2*9+3*2+5*1+6*1+7*0 = 35 135: 2*9+3*4+5*1+6*0+7*0 = 35 136: 2*10+3*0+5*3+6*0+7*0 = 35 137: 2*10+3*1+5*0+6*2+7*0 = 35 138: 2*10+3*1+5*1+6*0+7*1 = 35 139: 2*10+3*3+5*0+6*1+7*0 = 35 140: 2*10+3*5+5*0+6*0+7*0 = 35 141: 2*11+3*0+5*0+6*1+7*1 = 35 142: 2*11+3*1+5*2+6*0+7*0 = 35 143: 2*11+3*2+5*0+6*0+7*1 = 35 144: 2*12+3*0+5*1+6*1+7*0 = 35 145: 2*12+3*2+5*1+6*0+7*0 = 35 146: 2*13+3*1+5*0+6*1+7*0 = 35 147: 2*13+3*3+5*0+6*0+7*0 = 35 148: 2*14+3*0+5*0+6*0+7*1 = 35 149: 2*15+3*0+5*1+6*0+7*0 = 35 150: 2*16+3*1+5*0+6*0+7*0 = 35 diophantine_nd_positive_test(): diophantine_nd_positive() returns the positive solutions of a Diophantine equation in N variables. 2*x1+3*x2 = 18 2 solutions found. 1: 2*3+3*4 = 18 2: 2*6+3*2 = 18 6*x1+3*x2+13*x3 = 16 0 solutions found. 12*x1+9*x2+7*x3 = 60 1 solutions found. 1: 12*1+9*3+7*3 = 60 2*x1+3*x2+5*x3+6*x4 = 24 4 solutions found. 1: 2*1+3*2+5*2+6*1 = 24 2: 2*2+3*1+5*1+6*2 = 24 3: 2*2+3*3+5*1+6*1 = 24 4: 2*5+3*1+5*1+6*1 = 24 2*x1+3*x2+5*x3+6*x4+7*x5 = 35 10 solutions found. 1: 2*1+3*1+5*1+6*3+7*1 = 35 2: 2*1+3*1+5*2+6*1+7*2 = 35 3: 2*1+3*3+5*1+6*2+7*1 = 35 4: 2*1+3*5+5*1+6*1+7*1 = 35 5: 2*2+3*1+5*3+6*1+7*1 = 35 6: 2*2+3*2+5*1+6*1+7*2 = 35 7: 2*3+3*2+5*2+6*1+7*1 = 35 8: 2*4+3*1+5*1+6*2+7*1 = 35 9: 2*4+3*3+5*1+6*1+7*1 = 35 10: 2*7+3*1+5*1+6*1+7*1 = 35 DiopProbGenSingle_test(): Test DiopProbGenSingle() Example 8 Each row [n1 n2 ... nF] in the array below yields a parity violation: Press any key to continue [Warning: Pause with no arguments is not supported in non-interactive contexts.] [> In DiopProbGenSingle (line 96) In DiopProbGenSingle_test (line 38) In polyomino_parity_test (line 31) In run (line 91)] 4 2 1 15 8 1 2 14 13 2 1 13 17 1 2 12 22 2 1 11 26 1 2 10 31 2 1 9 35 1 2 8 40 2 1 7 44 1 2 6 49 2 1 5 53 1 2 4 58 2 1 3 62 1 2 2 67 2 1 1 Example 9 Each row [n1 n2 ... nF] in the array below yields a parity violation: Press any key to continue [Warning: Pause with no arguments is not supported in non-interactive contexts.] [> In DiopProbGenSingle (line 96) In DiopProbGenSingle_test (line 47) In polyomino_parity_test (line 31) In run (line 91)] 3 1 1 23 16 1 1 19 29 1 1 15 42 1 1 11 55 1 1 7 68 1 1 3 pv_search_test() MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 pv_search() applies parity arguments to potential solutions of a polyomino tiling problem. Example 6 parities = [ 0, 1 ] orders = [ 4, 3 ] p = 9 c = 41 2 trivial parity violations were found: 1: [ 5, 7 ] 2: [ 8, 3 ] 0 strong parity violations were found: Example 8 parities = [ 0, 2, 3, 5 ] orders = [ 2, 4, 5, 9 ] p = 0 c = 156 0 trivial parity violations were found: 15 strong parity violations were found: 1: [ 4, 2, 1, 15 ] 2: [ 8, 1, 2, 14 ] 3: [ 13, 2, 1, 13 ] 4: [ 17, 1, 2, 12 ] 5: [ 22, 2, 1, 11 ] 6: [ 26, 1, 2, 10 ] 7: [ 31, 2, 1, 9 ] 8: [ 35, 1, 2, 8 ] 9: [ 40, 2, 1, 7 ] 10: [ 44, 1, 2, 6 ] 11: [ 49, 2, 1, 5 ] 12: [ 53, 1, 2, 4 ] 13: [ 58, 2, 1, 3 ] 14: [ 62, 1, 2, 2 ] 15: [ 67, 2, 1, 1 ] Example 9 parities = [ 0, 1, 2, 5 ] orders = [ 4, 3, 6, 13 ] p = 0 c = 320 0 trivial parity violations were found: 6 strong parity violations were found: 1: [ 3, 1, 1, 23 ] 2: [ 16, 1, 1, 19 ] 3: [ 29, 1, 1, 15 ] 4: [ 42, 1, 1, 11 ] 5: [ 55, 1, 1, 7 ] 6: [ 68, 1, 1, 3 ] pv_search_test(): Normal end of execution. sumallsteps_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 sumallsteps() finds all possible sums, of the form S = Ai + N * ( +/- Q ) where: Ai is any single entry of the vector A N counts the number of +/- Q values to be added. Q is the magnitude of the increments or steps. For this example: A = [ 1, 2 ] N = 8 Q = 2 18 distinct sums were found: 1: -15 2: -14 3: -11 4: -10 5: -7 6: -6 7: -3 8: -2 9: 1 10: 2 11: 5 12: 6 13: 9 14: 10 15: 13 16: 14 17: 17 18: 18 polyomino_parity_test(): Normal end of execution. 08-Jan-2022 22:02:29