SURVO 98 edit field: 101 2000 300 (32 bit version) 0001|*SAVE JOONAS29 / Survo Puzzle 29/2006 0003|*Consider the following Survo Puzzle to be solved with distinct integers 0004|*1-16 so that the column and row sums are as stated below: 0006|* A B C D 0007|* 1 * * * * 18 0008|* 2 * * * * 27 0009|* 3 * * * * 40 0010|* 4 * * * * 51 0011|* 22 24 36 54 0013|*We will solve the puzzle by reducing the length of the interval of 0014|*possible integers for each of the unknown integers. At the beginning we 0015|*have the following situation: 0017|* A B C D 0018|* 1 1-16 1-16 1-16 1-16 18 S | 1111 1111 1111 1111 0019|* 2 1-16 1-16 1-16 1-16 27 S | 1111 1111 1111 1111 0020|* 3 1-16 1-16 1-16 1-16 40 S | 1111 1111 1111 1111 0021|* 4 1-16 1-16 1-16 1-16 51 S | 1111 1111 1111 1111 0022|* 22 24 36 54 0024|*The upper and lower bounds for D1 are 18-1-2-3=12 and 54-16-15-14=9: 0026|* A B C D 0027|* 1 1-16 1-16 1-16 9-12 18 S | 1 11 0028|* 2 1-16 1-16 1-16 1-16 27 0029|* 3 1-16 1-16 1-16 1-16 40 0030|* 4 1-16 1-16 1-16 1-16 51 0031|* 22 24 36 54 0033|*The upper bound for A1, B1 and C1 is 18-9-1-2=6, and the lower bound for 0034|*D2, D3 and D4 is 54-16-15-12=11: 0036|* A B C D 0037|* 1 1- 6 1- 6 1- 6 9-12 18 S | 1 1 1 0038|* 2 1-16 1-16 1-16 11-16 27 S | 11 0039|* 3 1-16 1-16 1-16 11-16 40 S | 11 0040|* 4 1-16 1-16 1-16 11-16 51 S | 11 0041|* 22 24 36 54 0043|*The upper bound for A2, B2 and C2 is 27-11-1-2=13, and the lower bound 0044|*for A4, B4 and C4 is 51-16-15-14=6: 0046|* A B C D 0047|* 1 1- 6 1- 6 1- 6 9-12 18 0048|* 2 1-13 1-13 1-13 11-16 27 S | 11 11 11 0049|* 3 1-16 1-16 1-16 11-16 40 0050|* 4 6-16 6-16 6-16 11-16 51 S | 1 1 1 0051|* 22 24 36 54 0053|*The upper bounds for A3 and B3 are 22-1-2-6=13 and 24-1-2-6=15, 0054|*respectively: 0056|* A B C D 0057|* 1 1- 6 1- 6 1- 6 9-12 18 0058|* 2 1-13 1-13 1-13 11-16 27 0059|* 3 1-13 1-15 1-16 11-16 40 S | 11 11 0060|* 4 6-16 6-16 6-16 11-16 51 0061|* 22 24 36 54 0063|*We will next prove that D1=10. To prove this we will choose D1 as 9, 11 0064|*and 12, respectively, and show that each one of these choices will lead 0065|*to a contradiction: 0067|*1. Choose D1=12: 0069|* The integers 1-3 are clearly present on the first row as 1+2+3+12=18. 0070|* Thus the lower bound for all the other unknown integers is at least 0071|* 4: 0073|* A B C D 0074|* 1 1- 3 1- 3 1- 3 12 18 S | 1 1 1 11 0075|* 2 4-13 4-13 4-13 11-16 27 S | 1 1 1 0076|* 3 4-13 4-15 4-16 11-16 40 S | 1 1 1 0077|* 4 6-16 6-16 6-16 11-16 51 0078|* 22 24 36 54 0080|* The upper bound for D2 is 27-4-5-6=12. This integer, however, has 0081|* already been assigned to D1, which means that D2=11, and that the 0082|* other integers on the second row are 4, 5 and 7 as 4+5+7+11=27: 0084|* A B C D 0085|* 1 1- 3 1- 3 1- 3 12 18 0086|* 2 4- 7 4- 7 4- 7 11 27 S | 1 1 1 11 0087|* 3 4-13 4-15 4-16 11-16 40 0088|* 4 6-16 6-16 6-16 11-16 51 0089|* 22 24 36 54 0091|* The unknown integers on the last column are 15 and 16 as 0092|* 12+11+15+16=54. Knowing that the integers 1-5, 7, 11-12 and 15-16 0093|* have already been used, the lower bound for A3-C4 is at least 6 and 0094|* the upper bound for them is 14 at most: 0096|* A B C D 0097|* 1 1- 3 1- 3 1- 3 12 18 0098|* 2 4- 7 4- 7 4- 7 11 27 0099|* 3 6-13 6-14 6-14 15-16 40 S | 1 1 11 1 11 11 0100|* 4 6-14 6-14 6-14 15-16 51 S | 11 11 11 11 0101|* 22 24 36 54 0103|* The upper bound for A3, B3 and C3 is 40-15-6-8=11. This integer, 0104|* however, has already been assigned to D2, so the upper bound for A3, 0105|* B3 and C3 is 10. 0107|* A B C D 0108|* 1 1- 3 1- 3 1- 3 12 18 0109|* 2 4- 7 4- 7 4- 7 11 27 0110|* 3 6-10 6-10 6-10 15-16 40 S | 11 11 11 0111|* 4 6-14 6-14 6-14 15-16 51 0112|* 22 24 36 54 0114|* The lower bound for C4 is 36-3-7-10=16, which is a contradiction: 0116|* A B C D 0117|* 1 1- 3 1- 3 1- 3 12 18 0118|* 2 4- 7 4- 7 4- 7 11 27 0119|* 3 6-10 6-10 6-10 15-16 40 0120|* 4 6-14 6-14 16-14 15-16 51 S | 11 0121|* 22 24 36 54 0123|*2. Choose D1=11: 0125|* The integers 1, 2 and 4 are clearly present on the first row as 0126|* 1+2+4+11=18. Thus the lower bound for all the other unknown integers 0127|* is at least 3: 0129|* A B C D 0130|* 1 1- 4 1- 4 1- 4 11 18 S | 1 1 1 11 0131|* 2 3-13 3-13 3-13 11-16 27 S | 1 1 1 0132|* 3 3-13 3-15 3-16 11-16 40 S | 1 1 1 0133|* 4 6-16 6-16 6-16 11-16 51 0134|* 22 24 36 54 0136|* The lower and upper bounds for D2 are 12 and 27-3-5-6=13: 0138|* A B C D 0139|* 1 1- 4 1- 4 1- 4 11 18 0140|* 2 3-13 3-13 3-13 12-13 27 S | 11 11 0141|* 3 3-13 3-15 3-16 11-16 40 0142|* 4 6-16 6-16 6-16 11-16 51 0143|* 22 24 36 54 0145|* The upper bound for A2, B2 and C2 is 27-12-3-5=7. This means that 3 0146|* and 5 are present on the second row. The remaining integers on the 0147|* second row are either 6 and 13 or 7 and 12. Knowing that the integers 0148|* 1-5 have already been used, the lower bound for A3, B3 and C3 is at 0149|* least 6. The lower bound for D3 and D4 is 54-11-13-16=14: 0151|* A B C D 0152|* 1 1- 4 1- 4 1- 4 11 18 0153|* 2 3- 7 3- 7 3- 7 12-13 27 S | 1 1 1 0154|* 3 6-13 6-15 6-16 14-16 40 S | 1 1 1 11 0155|* 4 6-16 6-16 6-16 14-16 51 S | 11 0156|* 22 24 36 54 0158|* The upper bound for A3, B3 and C3 is 40-14-6-8=12. The only 0159|* combinations of possible integers on the last column that sum up to 0160|* 54 are 11+12+15+16=54 and 11+13+14+16=54, and thus 16 is present on 0161|* the last column, and it can not be anywhere else: 0163|* A B C D 0164|* 1 1- 4 1- 4 1- 4 11 18 0165|* 2 3- 7 3- 7 3- 7 12-13 27 0166|* 3 6-12 6-12 6-12 14-16 40 S | 11 11 11 0167|* 4 6-15 6-15 6-15 14-16 51 S | 11 11 11 0168|* 22 24 36 54 0170|* The upper bounds for A4 and B4 are 22-1-3-6=12 and 24-1-3-6=14, 0171|* respectively, and the lower bound for C4 is 36-4-7-12=13: 0173|* A B C D 0174|* 1 1- 4 1- 4 1- 4 11 18 0175|* 2 3- 7 3- 7 3- 7 12-13 27 0176|* 3 6-12 6-12 6-12 14-16 40 0177|* 4 6-12 6-14 13-15 14-16 51 S | 11 11 11 0178|* 22 24 36 54 0180|* The lower bound for A4 and B4 is 51-16-15-12=8: 0182|* A B C D 0183|* 1 1- 4 1- 4 1- 4 11 18 0184|* 2 3- 7 3- 7 3- 7 12-13 27 0185|* 3 6-12 6-12 6-12 14-16 40 0186|* 4 8-12 8-14 13-15 14-16 51 S | 1 1 0187|* 22 24 36 54 0189|* The upper bound for A3 is 22-1-3-8=10, and the lower bounds for C1, 0190|* C2 and C3 are 36-15-10-7=4, 36-15-10-4=7 and 36-4-7-15=10, 0191|* respectively. Thus C1=4 and C2=7: 0193|* A B C D 0194|* 1 1- 4 1- 4 4 11 18 S | 1 0195|* 2 3- 7 3- 7 7 12-13 27 S | 1 0196|* 3 6-10 6-12 10-12 14-16 40 S | 11 11 0197|* 4 8-12 8-14 13-15 14-16 51 0198|* 22 24 36 54 0200|* The upper bound for A1 and B1 is 18-11-4-1=2, and the upper bound for 0201|* A2 and B2 is 27-12-7-3=5: 0203|* A B C D 0204|* 1 1- 2 1- 2 4 11 18 S | 1 1 0205|* 2 3- 5 3- 5 7 12-13 27 S | 1 1 0206|* 3 6-10 6-12 10-12 14-16 40 0207|* 4 8-12 8-14 13-15 14-16 51 0208|* 22 24 36 54 0210|* Thus D2 is 27-3-5-7=12: 0212|* A B C D 0213|* 1 1- 2 1- 2 4 11 18 0214|* 2 3- 5 3- 5 7 12 27 S | 11 0215|* 3 6-10 6-12 10-12 14-16 40 0216|* 4 8-12 8-14 13-15 14-16 51 0217|* 22 24 36 54 0219|* Thus C3=10, and the lower bound for D3 and D4 is 54-11-12-16=15: 0221|* A B C D 0222|* 1 1- 2 1- 2 4 11 18 0223|* 2 3- 5 3- 5 7 12 27 0224|* 3 6-10 6-12 10 15-16 40 S | 11 11 0225|* 4 8-12 8-14 13-15 15-16 51 S | 11 0226|* 22 24 36 54 0228|* Thus C4 is 36-4-7-10=15. This integer, however, has now been assigned 0229|* to two different columns, which is a contradiction: 0231|* A B C D 0232|* 1 1- 2 1- 2 4 11 18 0233|* 2 3- 5 3- 5 7 12 27 0234|* 3 6-10 6-12 10 15-16 40 0235|* 4 8-12 8-14 15 15-16 51 S | 11 0236|* 22 24 36 54 0238|*3. Choose D1=9: 0240|* The integers 14-16 are clearly present on the last column as 0241|* 9+14+15+16=54. Thus the upper bound for all the other integers is 13 0242|* at most: 0244|* A B C D 0245|* 1 1- 6 1- 6 1- 6 9 18 S | 1 0246|* 2 1-13 1-13 1-13 14-16 27 S | 11 0247|* 3 1-13 1-13 1-13 14-16 40 S | 11 11 11 0248|* 4 6-13 6-13 6-13 14-16 51 S | 11 11 11 11 0249|* 22 24 36 54 0251|* Either 1 or 2 must be present on the first row, otherwise the sum of 0252|* the integers on the first row would exceed 18. Thus the upper bound 0253|* for A2, B2 and C2 is 27-14-1-3=9. This integer, however, has already 0254|* been assigned to D1, so the upper bound for A2, B2 and C2 is 8. The 0255|* lower bound for A4, B4 and C4 is 51-16-13-12=10: 0257|* A B C D 0258|* 1 1- 6 1- 6 1- 6 9 18 0259|* 2 1- 8 1- 8 1- 8 14-16 27 S | 1 1 1 0260|* 3 1-13 1-13 1-13 14-16 40 0261|* 4 10-13 10-13 10-13 14-16 51 S | 11 11 11 0262|* 22 24 36 54 0264|* The upper bounds for A3 and B3 are 22-1-2-10=9 and 24-1-2-10=11, the 0265|* lower bounds for C1, C2 and C3 are 36-13-12-8=3, 36-13-12-6=5 and 0266|* 36-6-8-13=9, and the lower bound for D4 is 51-13-12-11=15, 0267|* respectively. However, 9 has already been assigned to D1, so the 0268|* upper bound for A3 is 8, and the lower bound for C3 is 10: 0270|* A B C D 0271|* 1 1- 6 1- 6 3- 6 9 18 S | 1 0272|* 2 1- 8 1- 8 5- 8 14-16 27 S | 1 0273|* 3 1- 8 1-11 10-13 14-16 40 S | 1 11 11 0274|* 4 10-13 10-13 10-13 15-16 51 S | 11 0275|* 22 24 36 54 0277|* Thus the four integers between 10-13 must be on places marked 10-13, 0278|* which means that the upper bound for B3 is 8. The integers 12-13 must 0279|* be on the last row as otherwise the integers on the last row would 0280|* not sum up to 51. Thus the upper bound for C3 is 11. The upper bound 0281|* for A1 and B1 is 18-9-3-1=5, the upper bound for A2 and B2 is 0282|* 27-14-5-1=7, and the lower bound for B3 is 40-16-13-8=3: 0284|* A B C D 0285|* 1 1- 5 1- 5 3- 6 9 18 S | 1 1 0286|* 2 1- 7 1- 7 5- 8 14-16 27 S | 1 1 0287|* 3 1- 8 3- 8 10-11 14-16 40 S | 1 1 11 0288|* 4 10-13 10-13 10-13 15-16 51 0289|* 22 24 36 54 0291|* The lower bound for A3 and B3 is 40-16-11-8=5, the lower bounds for 0292|* C1, C2 and C4 are 36-13-11-8=4, 36-13-11-6=6 and 36-6-8-11=11, 0293|* respectively: 0295|* A B C D 0296|* 1 1- 5 1- 5 4- 6 9 18 S | 1 0297|* 2 1- 7 1- 7 6- 8 14-16 27 S | 1 0298|* 3 5- 8 5- 8 10-11 14-16 40 S | 1 1 0299|* 4 10-13 10-13 11-13 15-16 51 S | 11 0300|* 22 24 36 54 0302|* The upper bound for A1 and B1 is 18-9-4-1=4, and the upper bound for 0303|* A2 and B2 is 27-14-6-1=6: 0305|* A B C D 0306|* 1 1- 4 1- 4 4- 6 9 18 S | 1 1 0307|* 2 1- 6 1- 6 6- 8 14-16 27 S | 1 1 0308|* 3 5- 8 5- 8 10-11 14-16 40 0309|* 4 10-13 10-13 11-13 15-16 51 0310|* 22 24 36 54 0312|* The upper bound for A1 and B1 is 3, because by choosing either A1 or 0313|* B1 as 4 the sum of the integers on the first row would exceed 18 (it 0314|* would be at least 1+4+5+9=19). Similarly, the upper bound for A2 and 0315|* B2 is 5, because by choosing either A2 or B2 as 6 the sum of the 0316|* integers on the second row would exceed 27 (it would be at least 0317|* 1+6+7+14=28). The lower bound for C2 is 7, because by choosing C2=6 0318|* the integers on third column would not sum up to 36 (the sum would be 0319|* 5+6+11+13=35 at most). 0321|* A B C D 0322|* 1 1- 3 1- 3 4- 6 9 18 S | 1 1 0323|* 2 1- 5 1- 5 7- 8 14-16 27 S | 1 1 1 0324|* 3 5- 8 5- 8 10-11 14-16 40 0325|* 4 10-13 10-13 11-13 15-16 51 0326|* 22 24 36 54 0328|* At the moment the integer 14 can be assigned to two different places: 0329|* D2 and D3. Let us assign D3=14: 0331|* A B C D 0332|* 1 1- 3 1- 3 4- 6 9 18 0333|* 2 1- 5 1- 5 7- 8 14-16 27 0334|* 3 5- 8 5- 8 10-11 14 40 S | 11 0335|* 4 10-13 10-13 11-13 15-16 51 0336|* 22 24 36 54 0338|* Now the integers on the third row can be chosen in only one possible 0339|* way: 7+8+11+14=40: 0341|* A B C D 0342|* 1 1- 3 1- 3 4- 6 9 18 0343|* 2 1- 5 1- 5 7- 8 14-16 27 0344|* 3 7- 8 7- 8 11 14 40 S | 1 1 11 0345|* 4 10-13 10-13 11-13 15-16 51 0346|* 22 24 36 54 0348|* However, we have already assigned one of the integers 7-8 to C2. Thus 0349|* we have a contradiction, which means that our assignment D3=14 is 0350|* false. This means that D2=14, and that the lower bound for D3 is 15: 0352|* A B C D 0353|* 1 1- 3 1- 3 4- 6 9 18 0354|* 2 1- 5 1- 5 7- 8 14 27 S | 11 0355|* 3 5- 8 5- 8 10-11 15-16 40 S | 11 0356|* 4 10-13 10-13 11-13 15-16 51 0357|* 22 24 36 54 0359|* At the moment we can assign two different integers to C3: 10 and 11. 0360|* Let us assign C3=10, which means that the lower bound for A4 and B4 0361|* is 11: 0363|* A B C D 0364|* 1 1- 3 1- 3 4- 6 9 18 0365|* 2 1- 5 1- 5 7- 8 14 27 0366|* 3 5- 8 5- 8 10 15-16 40 S | 11 0367|* 4 11-13 11-13 11-13 15-16 51 S | 11 11 0368|* 22 24 36 54 0370|* Now the integers on the last row can be chosen in only one possible 0371|* way: 11+12+13+15=51. This means that D4=15, and that D3=16: 0373|* A B C D 0374|* 1 1- 3 1- 3 4- 6 9 18 0375|* 2 1- 5 1- 5 7- 8 14 27 0376|* 3 5- 8 5- 8 10 16 40 S | 11 0377|* 4 11-13 11-13 11-13 15 51 S | 11 0378|* 22 24 36 54 0380|* The remaining integers on the third row can now be chosen in only one 0381|* possible way: 6+8+10+16=40. This means that the upper bound for C1 is 0382|* 5, and that C2=7: 0384|* A B C D 0385|* 1 1- 3 1- 3 4- 5 9 18 S | 1 0386|* 2 1- 5 1- 5 7 14 27 S | 1 0387|* 3 6- 8 6- 8 10 16 40 S | 1 1 0388|* 4 11-13 11-13 11-13 15 51 0389|* 22 24 36 54 0391|* The lower bound for C1 is 36-13-10-7=6, which is a contradiction, and 0392|* so our assigment C3=10 is false. This means that C3=11, and that the 0393|* lower bound for C4 is 12: 0395|* A B C D 0396|* 1 1- 3 1- 3 4- 6 9 18 0397|* 2 1- 5 1- 5 7- 8 14 27 0398|* 3 5- 8 5- 8 11 15-16 40 S | 11 0399|* 4 10-13 10-13 12-13 15-16 51 S | 11 0400|* 22 24 36 54 0402|* Now the integers on the last row can be chosen in only one possible 0403|* way: 10+12+13+16=51. This means that D4=16, and that D3=15: 0405|* A B C D 0406|* 1 1- 3 1- 3 4- 6 9 18 0407|* 2 1- 5 1- 5 7- 8 14 27 0408|* 3 5- 8 5- 8 11 15 40 S | 11 0409|* 4 10-13 10-13 12-13 16 51 S | 11 0410|* 22 24 36 54 0412|* The remaining integers on the third row can now be chosen in only one 0413|* possible way: 6+8+11+15=40. This means that the upper bound for C1 is 0414|* 5, and that C2=7 0416|* A B C D 0417|* 1 1- 3 1- 3 4- 5 9 18 S | 1 0418|* 2 1- 5 1- 5 7 14 27 S | 1 0419|* 3 6- 8 6- 8 11 15 40 S | 1 1 0420|* 4 10-13 10-13 12-13 16 51 0421|* 22 24 36 54 0423|* The lower bound for C1 is 36-13-11-7=5, which means that C1=5, and 0424|* that C4 is 36-5-7-11=13. This means that the upper bound for A2 and 0425|* B2 is 4, and that the upper bound for A4 and B4 is 12: 0427|* A B C D 0428|* 1 1- 3 1- 3 5 9 18 S | 1 0429|* 2 1- 4 1- 4 7 14 27 S | 1 1 0430|* 3 6- 8 6- 8 11 15 40 0431|* 4 10-12 10-12 13 16 51 S | 11 11 11 0432|* 22 24 36 54 0434|* Now the integers on the first row can be chosen in only one possible 0435|* way: 1+3+5+9=18. This means that the lower bound for A2 and B2 is 2: 0437|* A B C D 0438|* 1 1- 3 1- 3 5 9 18 0439|* 2 2- 4 2- 4 7 14 27 S | 1 1 0440|* 3 6- 8 6- 8 11 15 40 0441|* 4 10-12 10-12 13 16 51 0442|* 22 24 36 54 0444|* Now it is not possible to assign the remaining integers so that the 0445|* column sums would be as stated. Below are the only possible 0446|* combinations of remaining integers to be assigned to the first 0447|* column: 0449|* COMB P,CUR+1 / P=PARTITIONS,22,4 DISTINCT=1 MAX=12 OFF=5,7,9,11 S | 777777777777 0450|* Partitions 4 of 22: N[P]=3 0451|* 1 3 6 12 0452|* 1 3 8 10 0453|* 2 4 6 10 0455|* The results do not fit to the first column (we can not have 1+3 or 0456|* 2+4 on the same column). Thus we have a contradiction, which means 0457|* that our assignment D1=9 is false. 0459|*Thus we have proved that D1 can not be 9, 11 or 12, and so D1=10: 0461|* A B C D 0462|* 1 1- 6 1- 6 1- 6 10 18 S | 11 0463|* 2 1-13 1-13 1-13 11-16 27 0464|* 3 1-13 1-15 1-16 11-16 40 0465|* 4 6-16 6-16 6-16 11-16 51 0466|* 22 24 36 54 0468|*The integers 13, 15 and 16 are clearly present on the last column as 0469|*10+13+15+16=54. Thus the upper bound for all the other unknown integers 0470|*is 14 at most, but not 13. The upper bound for A1, B1 and C1 is 0471|*18-10-1-2=5: 0473|* A B C D 0474|* 1 1- 5 1- 5 1- 5 10 18 S | 1 1 1 0475|* 2 1-12 1-12 1-12 13-16 27 S | 11 11 11 11 0476|* 3 1-12 1-14 1-14 13-16 40 S | 11 11 11 11 0477|* 4 6-14 6-14 6-14 13-16 51 S | 11 11 11 11 0478|* 22 24 36 54 0480|*The only combinations of possible integers on the first row that sum up 0481|*to 18 are 1+2+5+10=18 and 1+3+4+10=18, and thus 1 is present on the 0482|*first row, and it can not be anywhere else: 0484|* A B C D 0485|* 1 1- 5 1- 5 1- 5 10 18 0486|* 2 2-12 2-12 2-12 13-16 27 S | 1 1 1 0487|* 3 2-12 2-14 2-14 13-16 40 S | 1 1 1 0488|* 4 6-14 6-14 6-14 13-16 51 0489|* 22 24 36 54 0491|*The upper bound for A2, B2 and C2 is 27-13-2-5=7, and the upper bound 0492|*for D2 is 27-2-5-6=14. However, we already know that 14 is not present 0493|*on the last column while 13 is. Thus D2=13, and the lower bound for D3 0494|*and D4 is 15: 0496|* A B C D 0497|* 1 1- 5 1- 5 1- 5 10 18 0498|* 2 2- 7 2- 7 2- 7 13 27 S | 1 1 1 11 0499|* 3 2-12 2-14 2-14 15-16 40 S | 11 0500|* 4 6-14 6-14 6-14 15-16 51 S | 11 0501|* 22 24 36 54 0503|*The lower bound for A4, B4 and C4 is 51-16-14-12=9: 0505|* A B C D 0506|* 1 1- 5 1- 5 1- 5 10 18 0507|* 2 2- 7 2- 7 2- 7 13 27 0508|* 3 2-12 2-14 2-14 15-16 40 0509|* 4 9-14 9-14 9-14 15-16 51 S | 1 1 1 0510|* 22 24 36 54 0512|*The upper bound for B3 is 24-1-2-9=12, and the lower bounds for C1, C2 0513|*and C3 are 36-14-12-7=3, 36-14-12-5=5 and 36-5-7-14=10, respectively. 0514|*However, 10 has already been assigned to D1, so the lower bound for C3 0515|*is 11: 0517|* A B C D 0518|* 1 1- 5 1- 5 3- 5 10 18 S | 1 0519|* 2 2- 7 2- 7 5- 7 13 27 S | 1 0520|* 3 2-12 2-12 11-14 15-16 40 S | 11 11 0521|* 4 9-14 9-14 9-14 15-16 51 0522|* 22 24 36 54 0524|*The upper bound for A1 and B1 is 18-10-3-1=4. 0526|* A B C D 0527|* 1 1- 4 1- 4 3- 5 10 18 S | 1 1 0528|* 2 2- 7 2- 7 5- 7 13 27 0529|* 3 2-12 2-12 11-14 15-16 40 0530|* 4 9-14 9-14 9-14 15-16 51 0531|* 22 24 36 54 0533|*If we did not use the integer 2 on the first row, it would be assigned 0534|*to the second row as otherwise the sum of the integers on the second row 0535|*would exceed 27 (first row would be 1+3+4+10=18 while the second row 0536|*would be at least 5+6+7+13=31). Thus 2 is present on one of the first 0537|*two rows, and it can not be anywhere else. Furthermore, we can say the 0538|*same thing about the integers 3 (first row would be 1+2+5+10=18 while 0539|*the second row would be at least 4+6+7+13=30), 4 (second row would be at 0540|*least 3+6+7+13=29) and 5 (second row would be at least 2+6+7+13=28). 0541|*Thus the lower bound for A3 and B3 is 6: 0543|* A B C D 0544|* 1 1- 4 1- 4 3- 5 10 18 0545|* 2 2- 7 2- 7 5- 7 13 27 0546|* 3 6-12 6-12 11-14 15-16 40 S | 1 1 0547|* 4 9-14 9-14 9-14 15-16 51 0548|* 22 24 36 54 0550|*The upper bounds for A2 and A4 are 22-9-6-1=6 and 22-1-2-6=13, 0551|*respectively, and the upper bound for A3 and B3 is 40-15-11-6=8. 0552|*However, 13 is already assigned to D2, and thus the upper bound for A4 0553|*is 12: 0555|* A B C D 0556|* 1 1- 4 1- 4 3- 5 10 18 0557|* 2 2- 6 2- 7 5- 7 13 27 S | 1 0558|* 3 6- 8 6- 8 11-14 15-16 40 S | 1 1 0559|* 4 9-12 9-14 9-14 15-16 51 S | 11 0560|* 22 24 36 54 0562|*The upper bound for C3 is 40-6-7-15=12: 0564|* A B C D 0565|* 1 1- 4 1- 4 3- 5 10 18 0566|* 2 2- 6 2- 7 5- 7 13 27 0567|* 3 6- 8 6- 8 11-12 15-16 40 S | 11 0568|* 4 9-12 9-14 9-14 15-16 51 0569|* 22 24 36 54 0571|*The lower bound for C4 is 36-5-7-12=12: 0573|* A B C D 0574|* 1 1- 4 1- 4 3- 5 10 18 0575|* 2 2- 6 2- 7 5- 7 13 27 0576|* 3 6- 8 6- 8 11-12 15-16 40 0577|* 4 9-12 9-14 12-14 15-16 51 S | 11 0578|* 22 24 36 54 0580|*At the moment the integer 8 can be assigned to two different places: A3 0581|*and B3. Let us assign B3=8: 0583|* A B C D 0584|* 1 1- 4 1- 4 3- 5 10 18 0585|* 2 2- 6 2- 7 5- 7 13 27 0586|* 3 6- 8 8 11-12 15-16 40 S | 1 0587|* 4 9-12 9-14 12-14 15-16 51 0588|* 22 24 36 54 0590|*Now the integers on the third row can be chosen in only one possible 0591|*way: 6+8+11+15=40: 0593|* A B C D 0594|* 1 1- 4 1- 4 3- 5 10 18 0595|* 2 2- 6 2- 7 5- 7 13 27 0596|* 3 6 8 11 15 40 S | 1 11 11 0597|* 4 9-12 9-14 12-14 15-16 51 0598|* 22 24 36 54 0600|*This means that the upper bound for A2 is 5, and that D4=16. The lower 0601|*bound for C4 is 36-5-7-11=13. This integer, however, has already been 0602|*assigned to D2, which means that C4=14, and it can not be anywhere else: 0604|* A B C D 0605|* 1 1- 4 1- 4 3- 5 10 18 0606|* 2 2- 5 2- 7 5- 7 13 27 S | 1 0607|* 3 6 8 11 15 40 0608|* 4 9-12 9-12 14 16 51 S | 11 11 11 0609|* 22 24 36 54 0611|*The lower bounds for C1 and C2 are 36-14-11-7=4 and 36-14-11-5=6, 0612|*respectively. However, 6 has already been assigned to A3, which means 0613|*that C2=7, and it can not be anywhere else: 0615|* A B C D 0616|* 1 1- 4 1- 4 4- 5 10 18 S | 1 0617|* 2 2- 5 2- 5 7 13 27 S | 1 1 0618|* 3 6 8 11 15 40 0619|* 4 9-12 9-12 14 16 51 0620|* 22 24 36 54 0622|*Thus C1 is 36-14-11-7=4, and the upper bound for A1 and B1 is 3: 0624|* A B C D 0625|* 1 1- 3 1- 3 4 10 18 S | 1 1 1 0626|* 2 2- 5 2- 5 7 13 27 0627|* 3 6 8 11 15 40 0628|* 4 9-12 9-12 14 16 51 0629|* 22 24 36 54 0631|*Now it is not possible to assign the remaining integers so that the 0632|*column sums would be as stated. Below are the only possible combinations 0633|*of remaining integers to be assigned to the first column: 0635|*COMB P,CUR+1 / P=PARTITIONS,16,3 DISTINCT=1 MAX=12 OFF=4,6,7,8,10,11 S | 777777777777 0636|*Partitions 3 of 16: N[P]=2 0637|*1 3 12 0638|*2 5 9 0640|*The results do not fit to the first column (we can not have 1+3 or 2+5 0641|*on the same column). Thus we have a contradiction, which means that our 0642|*assignment B3=8 is false. This means that A3=8: 0644|* A B C D 0645|* 1 1- 4 1- 4 3- 5 10 18 0646|* 2 2- 6 2- 7 5- 7 13 27 0647|* 3 8 6- 8 11-12 15-16 40 S | 1 0648|* 4 9-12 9-14 12-14 15-16 51 0649|* 22 24 36 54 0651|*Similarly as before, the integers on the third can be chosen in only one 0652|*possible way: 0654|* A B C D 0655|* 1 1- 4 1- 4 3- 5 10 18 0656|* 2 2- 6 2- 7 5- 7 13 27 0657|* 3 8 6 11 15 40 S | 1 11 11 0658|* 4 9-12 9-14 12-14 15-16 51 0659|* 22 24 36 54 0661|*Like before, the upper bound for A2 is 5, D4=16, and the lower bound for 0662|*C4 is 36-5-7-11=13. As 13 has already been assigned to D2, C4=14: 0664|* A B C D 0665|* 1 1- 4 1- 4 3- 5 10 18 0666|* 2 2- 5 2- 7 5- 7 13 27 S | 1 0667|* 3 8 6 11 15 40 0668|* 4 9-12 9-12 14 16 51 S | 11 11 11 0669|* 22 24 36 54 0671|*The lower bounds for C1 and C2 are 36-14-11-7=4 and 36-14-11-5=6, 0672|*respectively. However, 6 has already been assigned to A3, which means 0673|*that C2=7, and it can not be anywhere else. Thus C1 is 36-14-11-7=4: 0675|* A B C D 0676|* 1 1- 3 1- 3 4 10 18 S | 1 1 1 0677|* 2 2- 5 2- 5 7 13 27 S | 1 1 0678|* 3 8 6 11 15 40 0679|* 4 9-12 9-12 14 16 51 0680|* 22 24 36 54 0682|*The upper bound for A4 is 22-1-2-8=11, which means that A4=9 and B4=12. 0683|*Similarly, the upper bound for A2 is 22-9-8-1=4, and so A2=2 and B2=5. 0684|*Now A1 is 22-9-8-2=3, and so B1=1: 0686|* A B C D 0687|* 1 3 1 4 10 18 S | 1 1 0688|* 2 2 5 7 13 27 S | 1 1 0689|* 3 8 6 11 15 40 0690|* 4 9 12 14 16 51 S | 1 11 0691|* 22 24 36 54 0693|*This is the correct solution to the puzzle.