8
$\begingroup$

I have come across this puzzle a few times in competitions and rally's, and it has troubled me because I cannot seem to find a good approach to solving it, either programmatically or numerically. And I cannot even find traces of it online anymore, no name for it, or solution/solver.

It is basically a 7x7 grid, with 9 centers that should sum up to the cells around it:

# # # # # # #  
# A # B # C #  
# # # # # # #  
# D # E # F #  
# # # # # # #  
# G # H # I #  
# # # # # # #

the given are the numbers A,B,C,D,E,F,G,H,I and you need to solve the grid with numbers from 1 to 7 such as no number is used twice on any (COMPLETE) row or column (ie: rows and columns that don't intersect with A through I)

There may be more than one solution for any given set of numbers A thru I, though I cannot confirm this 100%

I have tried solving this with excel and matlab, the matlab code simply iterates through all sets of 7x7 matrices by swapping rows and columns already filled from 1 to 7. This solution may not solve the puzzle for certain sets of numbers A thru I, as it skips many sets of possible solutions.

Here is a trivial solution found by filling up the rows and columns from 1 to 7:

1 2 3 4 5 6 7
2 A 4 B 6 C 1
3 4 5 6 7 1 2
4 D 6 E 1 F 3
5 6 7 1 2 3 4
6 G 1 H 3 I 5
7 1 2 3 4 5 6

In this case we have:
A = 24
B = 40
C = 35
D = 40
E = 35
F = 23
G = 35
H = 23
I = 32

EDIT:
Here is one form of the puzzle itself, you can at least try to solve this one. I have managed to obtain the solution through brute-force and 6 hours of computation, however that isn't the method I was hoping for. Good luck:

## ## ## ## ## ## ##  
## 15 ## 28 ## 44 ##  
## ## ## ## ## ## ##  
## 33 ## 36 ## 36 ##  
## ## ## ## ## ## ##  
## 46 ## 31 ## 19 ##  
## ## ## ## ## ## ##
$\endgroup$
  • 1
    $\begingroup$ What is your question? Are you looking for a way to attack such problems? And are there prescribed cells apart from the sums? $\endgroup$ – M Oehm Oct 25 '16 at 16:30
  • $\begingroup$ If you want a programming solution I would start by understanding a depth first brute force sudoku solver. Here is an explained one in python with links to a number of other languages. Obviously it would need some tweaks but it would be a good place to start. $\endgroup$ – gtwebb Oct 25 '16 at 16:45
  • $\begingroup$ I am looking for a way to be able to solve this puzzle. Brute force solutions are generally too long of an approach that I was hoping not to tackle, but I will check out the link and see if I can get anywhere concrete with solving this puzzle. There are no other prescribed cells, just the 9 center cells given with the required numbers, and you have to fill all remaining cells. $\endgroup$ – ThaBomb Oct 25 '16 at 17:13
  • 1
    $\begingroup$ I suggest you to edit your question so that to include a puzzle. Then people can start answering it by sharing code fragments, insight, etc. It could very well turn out, that some sort of intelligent brute-force won't take as long as you anticipate. In practice you should start taking the integer partitions of the number A, and then B, and then D so that to fill out the entries between cells A and B, and A and D, and then move on to the next cells by keeping in mind that the full rows contain a permutation. It is tedious to program down, but I expect that will run quite fast. $\endgroup$ – Matsmath Oct 25 '16 at 19:16
  • 1
    $\begingroup$ I think there must be a typo in the last problem. If you sum A through I you get 288. This should be 12×28 minus positions 3 and 5 in first row, last row, first column, last column plus corners. But the least you can get is if you subtract 6, 7, 6, 7, 6, 7, 6, 7 and add 1, 2, 1, 2, and that's 290. $\endgroup$ – The Vee Oct 27 '16 at 22:16
8
$\begingroup$

This is quite easy to formulate as a 0-1 integer linear programming problem and then throw at a specialised solver. With no objective function to optimise, lp_solve takes less than a second to give:

2134567
1-1-3-5
4123756
3-5-6-4
6572431
5-6-2-3
7645132

If I ask it to minimise the total sum, it gives

2143657
1-1-3-5
3124576
4-5-7-4
7563421
5-7-2-3
6735142

If I ask it to maximise the total sum, it gives

3125674
2-1-2-7
1234576
5-5-7-5
4765123
7-4-3-1
6571432

That one took longest: 0.9 seconds.

I wrote a small script to try to find a solution maximising each variable individually (i.e. first it tries to find a solution with a 1 in the top-left corner; then one with a 2; etc.) and after deduplicating results I was left with 22 solutions. This isn't even guaranteed to be a complete set of solutions (and in fact only includes one of the three solutions given above), but:

1234567
2-1-2-6
3124765
5-4-6-4
6572413
4-6-3-1
7653142

1234576
2-1-2-7
3125674
6-4-7-3
4672315
5-6-1-2
7653421

1234576
2-1-3-5
3124657
4-5-7-4
5673241
6-4-4-2
7564123

1235467
2-1-3-6
3124675
4-5-7-4
6573241
5-6-1-3
7643512

2134567
1-1-3-5
4123756
3-5-6-4
6572431
5-6-2-3
7645132

2134567
1-2-2-6
3214765
4-5-6-4
5672431
6-4-3-2
7564123

2134675
1-2-3-6
3215467
5-5-7-4
4763512
7-4-1-3
6573241

2134675
1-2-3-6
3215467
6-4-7-4
4673512
5-6-2-1
7652143

2135467
1-1-3-6
4123765
3-6-6-4
7643521
6-5-2-3
5674132

2135467
1-2-3-6
3214675
6-4-7-2
4672513
5-6-2-1
7653124

2135674
1-2-2-7
3214576
4-5-7-5
5674312
6-4-4-1
7562143

2143567
1-1-2-6
3124765
4-5-6-4
5672341
6-6-1-3
7635412

2143567
1-1-2-6
3124765
4-5-6-4
7562413
5-7-3-1
6735142

2143576
1-1-3-5
3124657
6-3-7-4
5673421
4-6-2-3
7653142

2143657
1-1-3-5
3124576
4-5-7-3
6572431
7-6-2-2
5736124

3124567
1-1-2-6
2143765
5-3-6-4
6572413
4-6-3-1
7653142

3124576
1-1-3-5
2143657
4-6-7-4
6735241
5-7-4-2
7654123

3124576
1-1-3-5
2143657
4-6-7-4
7635241
5-7-4-2
6754123

3124576
1-1-3-5
2143657
5-3-7-4
7563412
6-5-1-3
4673251

3124657
1-1-3-5
2143576
5-3-7-4
6573421
4-6-2-3
7653142

3124675
2-1-1-7
1234756
4-5-5-4
5671423
6-4-2-2
7564321

3125674
1-1-2-7
2143576
5-3-7-5
6574321
4-6-1-3
7651432

3214675
1-2-1-7
2134756
4-5-5-4
5671423
6-4-2-2
7564321

I conclude that a good part of the reason for the puzzle being so hard to do by hand is that it has too many solutions to commit to any cell values: you have to be prepared to backtrack. The lack of constraints on non-repetition in "incomplete" rows and columns doesn't help: if no repetitions were allowed there either then the 15 in the top-left would be a very strong constraint, requiring its neighbourhood to be one of the eight symmetries of

123
2-1
312

But, as you can see, thirteen of the solutions above don't have that form.

To make the answer self-contained, here's my input file for lp_solve with the objective of maximimising the total sum. The only values which need changing to solve a different instance of the puzzle are those in the nine lines following /* Appropriate totals */.

max: 1 x001 + 2 x002 + 3 x003 + 4 x004 + 5 x005 + 6 x006 + 7 x007 + 1 x011 + 2 x012 + 3 x013 + 4 x014 + 5 x015 + 6 x016 + 7 x017 + 1 x021 + 2 x022 + 3 x023 + 4 x024 + 5 x025 + 6 x026 + 7 x027 + 1 x101 + 2 x102 + 3 x103 + 4 x104 + 5 x105 + 6 x106 + 7 x107 + 1 x121 + 2 x122 + 3 x123 + 4 x124 + 5 x125 + 6 x126 + 7 x127 + 1 x201 + 2 x202 + 3 x203 + 4 x204 + 5 x205 + 6 x206 + 7 x207 + 1 x211 + 2 x212 + 3 x213 + 4 x214 + 5 x215 + 6 x216 + 7 x217 + 1 x221 + 2 x222 + 3 x223 + 4 x224 + 5 x225 + 6 x226 + 7 x227 + 1 x031 + 2 x032 + 3 x033 + 4 x034 + 5 x035 + 6 x036 + 7 x037 + 1 x041 + 2 x042 + 3 x043 + 4 x044 + 5 x045 + 6 x046 + 7 x047 + 1 x141 + 2 x142 + 3 x143 + 4 x144 + 5 x145 + 6 x146 + 7 x147 + 1 x221 + 2 x222 + 3 x223 + 4 x224 + 5 x225 + 6 x226 + 7 x227 + 1 x231 + 2 x232 + 3 x233 + 4 x234 + 5 x235 + 6 x236 + 7 x237 + 1 x241 + 2 x242 + 3 x243 + 4 x244 + 5 x245 + 6 x246 + 7 x247 + 1 x051 + 2 x052 + 3 x053 + 4 x054 + 5 x055 + 6 x056 + 7 x057 + 1 x061 + 2 x062 + 3 x063 + 4 x064 + 5 x065 + 6 x066 + 7 x067 + 1 x161 + 2 x162 + 3 x163 + 4 x164 + 5 x165 + 6 x166 + 7 x167 + 1 x241 + 2 x242 + 3 x243 + 4 x244 + 5 x245 + 6 x246 + 7 x247 + 1 x251 + 2 x252 + 3 x253 + 4 x254 + 5 x255 + 6 x256 + 7 x257 + 1 x261 + 2 x262 + 3 x263 + 4 x264 + 5 x265 + 6 x266 + 7 x267 + 1 x301 + 2 x302 + 3 x303 + 4 x304 + 5 x305 + 6 x306 + 7 x307 + 1 x321 + 2 x322 + 3 x323 + 4 x324 + 5 x325 + 6 x326 + 7 x327 + 1 x401 + 2 x402 + 3 x403 + 4 x404 + 5 x405 + 6 x406 + 7 x407 + 1 x411 + 2 x412 + 3 x413 + 4 x414 + 5 x415 + 6 x416 + 7 x417 + 1 x421 + 2 x422 + 3 x423 + 4 x424 + 5 x425 + 6 x426 + 7 x427 + 1 x341 + 2 x342 + 3 x343 + 4 x344 + 5 x345 + 6 x346 + 7 x347 + 1 x421 + 2 x422 + 3 x423 + 4 x424 + 5 x425 + 6 x426 + 7 x427 + 1 x431 + 2 x432 + 3 x433 + 4 x434 + 5 x435 + 6 x436 + 7 x437 + 1 x441 + 2 x442 + 3 x443 + 4 x444 + 5 x445 + 6 x446 + 7 x447 + 1 x261 + 2 x262 + 3 x263 + 4 x264 + 5 x265 + 6 x266 + 7 x267 + 1 x361 + 2 x362 + 3 x363 + 4 x364 + 5 x365 + 6 x366 + 7 x367 + 1 x441 + 2 x442 + 3 x443 + 4 x444 + 5 x445 + 6 x446 + 7 x447 + 1 x451 + 2 x452 + 3 x453 + 4 x454 + 5 x455 + 6 x456 + 7 x457 + 1 x461 + 2 x462 + 3 x463 + 4 x464 + 5 x465 + 6 x466 + 7 x467 + 1 x501 + 2 x502 + 3 x503 + 4 x504 + 5 x505 + 6 x506 + 7 x507 + 1 x521 + 2 x522 + 3 x523 + 4 x524 + 5 x525 + 6 x526 + 7 x527 + 1 x601 + 2 x602 + 3 x603 + 4 x604 + 5 x605 + 6 x606 + 7 x607 + 1 x611 + 2 x612 + 3 x613 + 4 x614 + 5 x615 + 6 x616 + 7 x617 + 1 x621 + 2 x622 + 3 x623 + 4 x624 + 5 x625 + 6 x626 + 7 x627 + 1 x541 + 2 x542 + 3 x543 + 4 x544 + 5 x545 + 6 x546 + 7 x547 + 1 x621 + 2 x622 + 3 x623 + 4 x624 + 5 x625 + 6 x626 + 7 x627 + 1 x631 + 2 x632 + 3 x633 + 4 x634 + 5 x635 + 6 x636 + 7 x637 + 1 x641 + 2 x642 + 3 x643 + 4 x644 + 5 x645 + 6 x646 + 7 x647 + 1 x461 + 2 x462 + 3 x463 + 4 x464 + 5 x465 + 6 x466 + 7 x467 + 1 x561 + 2 x562 + 3 x563 + 4 x564 + 5 x565 + 6 x566 + 7 x567 + 1 x641 + 2 x642 + 3 x643 + 4 x644 + 5 x645 + 6 x646 + 7 x647 + 1 x651 + 2 x652 + 3 x653 + 4 x654 + 5 x655 + 6 x656 + 7 x657 + 1 x661 + 2 x662 + 3 x663 + 4 x664 + 5 x665 + 6 x666 + 7 x667;

/* Variable names are xrcv where r is the 0-indexed row, c is the 0-indexed column, and v is the 1-indexed value. */
/* The variables are binary (0-1), so precisely one of each xrc* is 1, and that gives the value at (r, c). */

x001 + x002 + x003 + x004 + x005 + x006 + x007 = 1;
x011 + x012 + x013 + x014 + x015 + x016 + x017 = 1;
x021 + x022 + x023 + x024 + x025 + x026 + x027 = 1;
x031 + x032 + x033 + x034 + x035 + x036 + x037 = 1;
x041 + x042 + x043 + x044 + x045 + x046 + x047 = 1;
x051 + x052 + x053 + x054 + x055 + x056 + x057 = 1;
x061 + x062 + x063 + x064 + x065 + x066 + x067 = 1;
x101 + x102 + x103 + x104 + x105 + x106 + x107 = 1;
x121 + x122 + x123 + x124 + x125 + x126 + x127 = 1;
x141 + x142 + x143 + x144 + x145 + x146 + x147 = 1;
x161 + x162 + x163 + x164 + x165 + x166 + x167 = 1;
x201 + x202 + x203 + x204 + x205 + x206 + x207 = 1;
x211 + x212 + x213 + x214 + x215 + x216 + x217 = 1;
x221 + x222 + x223 + x224 + x225 + x226 + x227 = 1;
x231 + x232 + x233 + x234 + x235 + x236 + x237 = 1;
x241 + x242 + x243 + x244 + x245 + x246 + x247 = 1;
x251 + x252 + x253 + x254 + x255 + x256 + x257 = 1;
x261 + x262 + x263 + x264 + x265 + x266 + x267 = 1;
x301 + x302 + x303 + x304 + x305 + x306 + x307 = 1;
x321 + x322 + x323 + x324 + x325 + x326 + x327 = 1;
x341 + x342 + x343 + x344 + x345 + x346 + x347 = 1;
x361 + x362 + x363 + x364 + x365 + x366 + x367 = 1;
x401 + x402 + x403 + x404 + x405 + x406 + x407 = 1;
x411 + x412 + x413 + x414 + x415 + x416 + x417 = 1;
x421 + x422 + x423 + x424 + x425 + x426 + x427 = 1;
x431 + x432 + x433 + x434 + x435 + x436 + x437 = 1;
x441 + x442 + x443 + x444 + x445 + x446 + x447 = 1;
x451 + x452 + x453 + x454 + x455 + x456 + x457 = 1;
x461 + x462 + x463 + x464 + x465 + x466 + x467 = 1;
x501 + x502 + x503 + x504 + x505 + x506 + x507 = 1;
x521 + x522 + x523 + x524 + x525 + x526 + x527 = 1;
x541 + x542 + x543 + x544 + x545 + x546 + x547 = 1;
x561 + x562 + x563 + x564 + x565 + x566 + x567 = 1;
x601 + x602 + x603 + x604 + x605 + x606 + x607 = 1;
x611 + x612 + x613 + x614 + x615 + x616 + x617 = 1;
x621 + x622 + x623 + x624 + x625 + x626 + x627 = 1;
x631 + x632 + x633 + x634 + x635 + x636 + x637 = 1;
x641 + x642 + x643 + x644 + x645 + x646 + x647 = 1;
x651 + x652 + x653 + x654 + x655 + x656 + x657 = 1;
x661 + x662 + x663 + x664 + x665 + x666 + x667 = 1;

/* No number repeats in a row */

x001 + x011 + x021 + x031 + x041 + x051 + x061 = 1;
x002 + x012 + x022 + x032 + x042 + x052 + x062 = 1;
x003 + x013 + x023 + x033 + x043 + x053 + x063 = 1;
x004 + x014 + x024 + x034 + x044 + x054 + x064 = 1;
x005 + x015 + x025 + x035 + x045 + x055 + x065 = 1;
x006 + x016 + x026 + x036 + x046 + x056 + x066 = 1;
x007 + x017 + x027 + x037 + x047 + x057 + x067 = 1;
x201 + x211 + x221 + x231 + x241 + x251 + x261 = 1;
x202 + x212 + x222 + x232 + x242 + x252 + x262 = 1;
x203 + x213 + x223 + x233 + x243 + x253 + x263 = 1;
x204 + x214 + x224 + x234 + x244 + x254 + x264 = 1;
x205 + x215 + x225 + x235 + x245 + x255 + x265 = 1;
x206 + x216 + x226 + x236 + x246 + x256 + x266 = 1;
x207 + x217 + x227 + x237 + x247 + x257 + x267 = 1;
x401 + x411 + x421 + x431 + x441 + x451 + x461 = 1;
x402 + x412 + x422 + x432 + x442 + x452 + x462 = 1;
x403 + x413 + x423 + x433 + x443 + x453 + x463 = 1;
x404 + x414 + x424 + x434 + x444 + x454 + x464 = 1;
x405 + x415 + x425 + x435 + x445 + x455 + x465 = 1;
x406 + x416 + x426 + x436 + x446 + x456 + x466 = 1;
x407 + x417 + x427 + x437 + x447 + x457 + x467 = 1;
x601 + x611 + x621 + x631 + x641 + x651 + x661 = 1;
x602 + x612 + x622 + x632 + x642 + x652 + x662 = 1;
x603 + x613 + x623 + x633 + x643 + x653 + x663 = 1;
x604 + x614 + x624 + x634 + x644 + x654 + x664 = 1;
x605 + x615 + x625 + x635 + x645 + x655 + x665 = 1;
x606 + x616 + x626 + x636 + x646 + x656 + x666 = 1;
x607 + x617 + x627 + x637 + x647 + x657 + x667 = 1;

/* No number repeats in a column */

x001 + x101 + x201 + x301 + x401 + x501 + x601 = 1;
x002 + x102 + x202 + x302 + x402 + x502 + x602 = 1;
x003 + x103 + x203 + x303 + x403 + x503 + x603 = 1;
x004 + x104 + x204 + x304 + x404 + x504 + x604 = 1;
x005 + x105 + x205 + x305 + x405 + x505 + x605 = 1;
x006 + x106 + x206 + x306 + x406 + x506 + x606 = 1;
x007 + x107 + x207 + x307 + x407 + x507 + x607 = 1;
x021 + x121 + x221 + x321 + x421 + x521 + x621 = 1;
x022 + x122 + x222 + x322 + x422 + x522 + x622 = 1;
x023 + x123 + x223 + x323 + x423 + x523 + x623 = 1;
x024 + x124 + x224 + x324 + x424 + x524 + x624 = 1;
x025 + x125 + x225 + x325 + x425 + x525 + x625 = 1;
x026 + x126 + x226 + x326 + x426 + x526 + x626 = 1;
x027 + x127 + x227 + x327 + x427 + x527 + x627 = 1;
x041 + x141 + x241 + x341 + x441 + x541 + x641 = 1;
x042 + x142 + x242 + x342 + x442 + x542 + x642 = 1;
x043 + x143 + x243 + x343 + x443 + x543 + x643 = 1;
x044 + x144 + x244 + x344 + x444 + x544 + x644 = 1;
x045 + x145 + x245 + x345 + x445 + x545 + x645 = 1;
x046 + x146 + x246 + x346 + x446 + x546 + x646 = 1;
x047 + x147 + x247 + x347 + x447 + x547 + x647 = 1;
x061 + x161 + x261 + x361 + x461 + x561 + x661 = 1;
x062 + x162 + x262 + x362 + x462 + x562 + x662 = 1;
x063 + x163 + x263 + x363 + x463 + x563 + x663 = 1;
x064 + x164 + x264 + x364 + x464 + x564 + x664 = 1;
x065 + x165 + x265 + x365 + x465 + x565 + x665 = 1;
x066 + x166 + x266 + x366 + x466 + x566 + x666 = 1;
x067 + x167 + x267 + x367 + x467 + x567 + x667 = 1;

/* Appropriate totals */

1 x001 + 2 x002 + 3 x003 + 4 x004 + 5 x005 + 6 x006 + 7 x007 + 1 x011 + 2 x012 + 3 x013 + 4 x014 + 5 x015 + 6 x016 + 7 x017 + 1 x021 + 2 x022 + 3 x023 + 4 x024 + 5 x025 + 6 x026 + 7 x027 + 1 x101 + 2 x102 + 3 x103 + 4 x104 + 5 x105 + 6 x106 + 7 x107 + 1 x121 + 2 x122 + 3 x123 + 4 x124 + 5 x125 + 6 x126 + 7 x127 + 1 x201 + 2 x202 + 3 x203 + 4 x204 + 5 x205 + 6 x206 + 7 x207 + 1 x211 + 2 x212 + 3 x213 + 4 x214 + 5 x215 + 6 x216 + 7 x217 + 1 x221 + 2 x222 + 3 x223 + 4 x224 + 5 x225 + 6 x226 + 7 x227 = 15;
1 x021 + 2 x022 + 3 x023 + 4 x024 + 5 x025 + 6 x026 + 7 x027 + 1 x031 + 2 x032 + 3 x033 + 4 x034 + 5 x035 + 6 x036 + 7 x037 + 1 x041 + 2 x042 + 3 x043 + 4 x044 + 5 x045 + 6 x046 + 7 x047 + 1 x121 + 2 x122 + 3 x123 + 4 x124 + 5 x125 + 6 x126 + 7 x127 + 1 x141 + 2 x142 + 3 x143 + 4 x144 + 5 x145 + 6 x146 + 7 x147 + 1 x221 + 2 x222 + 3 x223 + 4 x224 + 5 x225 + 6 x226 + 7 x227 + 1 x231 + 2 x232 + 3 x233 + 4 x234 + 5 x235 + 6 x236 + 7 x237 + 1 x241 + 2 x242 + 3 x243 + 4 x244 + 5 x245 + 6 x246 + 7 x247 = 28;
1 x041 + 2 x042 + 3 x043 + 4 x044 + 5 x045 + 6 x046 + 7 x047 + 1 x051 + 2 x052 + 3 x053 + 4 x054 + 5 x055 + 6 x056 + 7 x057 + 1 x061 + 2 x062 + 3 x063 + 4 x064 + 5 x065 + 6 x066 + 7 x067 + 1 x141 + 2 x142 + 3 x143 + 4 x144 + 5 x145 + 6 x146 + 7 x147 + 1 x161 + 2 x162 + 3 x163 + 4 x164 + 5 x165 + 6 x166 + 7 x167 + 1 x241 + 2 x242 + 3 x243 + 4 x244 + 5 x245 + 6 x246 + 7 x247 + 1 x251 + 2 x252 + 3 x253 + 4 x254 + 5 x255 + 6 x256 + 7 x257 + 1 x261 + 2 x262 + 3 x263 + 4 x264 + 5 x265 + 6 x266 + 7 x267 = 44;
1 x201 + 2 x202 + 3 x203 + 4 x204 + 5 x205 + 6 x206 + 7 x207 + 1 x211 + 2 x212 + 3 x213 + 4 x214 + 5 x215 + 6 x216 + 7 x217 + 1 x221 + 2 x222 + 3 x223 + 4 x224 + 5 x225 + 6 x226 + 7 x227 + 1 x301 + 2 x302 + 3 x303 + 4 x304 + 5 x305 + 6 x306 + 7 x307 + 1 x321 + 2 x322 + 3 x323 + 4 x324 + 5 x325 + 6 x326 + 7 x327 + 1 x401 + 2 x402 + 3 x403 + 4 x404 + 5 x405 + 6 x406 + 7 x407 + 1 x411 + 2 x412 + 3 x413 + 4 x414 + 5 x415 + 6 x416 + 7 x417 + 1 x421 + 2 x422 + 3 x423 + 4 x424 + 5 x425 + 6 x426 + 7 x427 = 33;
1 x221 + 2 x222 + 3 x223 + 4 x224 + 5 x225 + 6 x226 + 7 x227 + 1 x231 + 2 x232 + 3 x233 + 4 x234 + 5 x235 + 6 x236 + 7 x237 + 1 x241 + 2 x242 + 3 x243 + 4 x244 + 5 x245 + 6 x246 + 7 x247 + 1 x321 + 2 x322 + 3 x323 + 4 x324 + 5 x325 + 6 x326 + 7 x327 + 1 x341 + 2 x342 + 3 x343 + 4 x344 + 5 x345 + 6 x346 + 7 x347 + 1 x421 + 2 x422 + 3 x423 + 4 x424 + 5 x425 + 6 x426 + 7 x427 + 1 x431 + 2 x432 + 3 x433 + 4 x434 + 5 x435 + 6 x436 + 7 x437 + 1 x441 + 2 x442 + 3 x443 + 4 x444 + 5 x445 + 6 x446 + 7 x447 = 36;
1 x241 + 2 x242 + 3 x243 + 4 x244 + 5 x245 + 6 x246 + 7 x247 + 1 x251 + 2 x252 + 3 x253 + 4 x254 + 5 x255 + 6 x256 + 7 x257 + 1 x261 + 2 x262 + 3 x263 + 4 x264 + 5 x265 + 6 x266 + 7 x267 + 1 x341 + 2 x342 + 3 x343 + 4 x344 + 5 x345 + 6 x346 + 7 x347 + 1 x361 + 2 x362 + 3 x363 + 4 x364 + 5 x365 + 6 x366 + 7 x367 + 1 x441 + 2 x442 + 3 x443 + 4 x444 + 5 x445 + 6 x446 + 7 x447 + 1 x451 + 2 x452 + 3 x453 + 4 x454 + 5 x455 + 6 x456 + 7 x457 + 1 x461 + 2 x462 + 3 x463 + 4 x464 + 5 x465 + 6 x466 + 7 x467 = 36;
1 x401 + 2 x402 + 3 x403 + 4 x404 + 5 x405 + 6 x406 + 7 x407 + 1 x411 + 2 x412 + 3 x413 + 4 x414 + 5 x415 + 6 x416 + 7 x417 + 1 x421 + 2 x422 + 3 x423 + 4 x424 + 5 x425 + 6 x426 + 7 x427 + 1 x501 + 2 x502 + 3 x503 + 4 x504 + 5 x505 + 6 x506 + 7 x507 + 1 x521 + 2 x522 + 3 x523 + 4 x524 + 5 x525 + 6 x526 + 7 x527 + 1 x601 + 2 x602 + 3 x603 + 4 x604 + 5 x605 + 6 x606 + 7 x607 + 1 x611 + 2 x612 + 3 x613 + 4 x614 + 5 x615 + 6 x616 + 7 x617 + 1 x621 + 2 x622 + 3 x623 + 4 x624 + 5 x625 + 6 x626 + 7 x627 = 46;
1 x421 + 2 x422 + 3 x423 + 4 x424 + 5 x425 + 6 x426 + 7 x427 + 1 x431 + 2 x432 + 3 x433 + 4 x434 + 5 x435 + 6 x436 + 7 x437 + 1 x441 + 2 x442 + 3 x443 + 4 x444 + 5 x445 + 6 x446 + 7 x447 + 1 x521 + 2 x522 + 3 x523 + 4 x524 + 5 x525 + 6 x526 + 7 x527 + 1 x541 + 2 x542 + 3 x543 + 4 x544 + 5 x545 + 6 x546 + 7 x547 + 1 x621 + 2 x622 + 3 x623 + 4 x624 + 5 x625 + 6 x626 + 7 x627 + 1 x631 + 2 x632 + 3 x633 + 4 x634 + 5 x635 + 6 x636 + 7 x637 + 1 x641 + 2 x642 + 3 x643 + 4 x644 + 5 x645 + 6 x646 + 7 x647 = 31;
1 x441 + 2 x442 + 3 x443 + 4 x444 + 5 x445 + 6 x446 + 7 x447 + 1 x451 + 2 x452 + 3 x453 + 4 x454 + 5 x455 + 6 x456 + 7 x457 + 1 x461 + 2 x462 + 3 x463 + 4 x464 + 5 x465 + 6 x466 + 7 x467 + 1 x541 + 2 x542 + 3 x543 + 4 x544 + 5 x545 + 6 x546 + 7 x547 + 1 x561 + 2 x562 + 3 x563 + 4 x564 + 5 x565 + 6 x566 + 7 x567 + 1 x641 + 2 x642 + 3 x643 + 4 x644 + 5 x645 + 6 x646 + 7 x647 + 1 x651 + 2 x652 + 3 x653 + 4 x654 + 5 x655 + 6 x656 + 7 x657 + 1 x661 + 2 x662 + 3 x663 + 4 x664 + 5 x665 + 6 x666 + 7 x667 = 19;

/* Variables are 0-1 */

bin x001, x002, x003, x004, x005, x006, x007;
bin x011, x012, x013, x014, x015, x016, x017;
bin x021, x022, x023, x024, x025, x026, x027;
bin x031, x032, x033, x034, x035, x036, x037;
bin x041, x042, x043, x044, x045, x046, x047;
bin x051, x052, x053, x054, x055, x056, x057;
bin x061, x062, x063, x064, x065, x066, x067;
bin x101, x102, x103, x104, x105, x106, x107;
bin x121, x122, x123, x124, x125, x126, x127;
bin x141, x142, x143, x144, x145, x146, x147;
bin x161, x162, x163, x164, x165, x166, x167;
bin x201, x202, x203, x204, x205, x206, x207;
bin x211, x212, x213, x214, x215, x216, x217;
bin x221, x222, x223, x224, x225, x226, x227;
bin x231, x232, x233, x234, x235, x236, x237;
bin x241, x242, x243, x244, x245, x246, x247;
bin x251, x252, x253, x254, x255, x256, x257;
bin x261, x262, x263, x264, x265, x266, x267;
bin x301, x302, x303, x304, x305, x306, x307;
bin x321, x322, x323, x324, x325, x326, x327;
bin x341, x342, x343, x344, x345, x346, x347;
bin x361, x362, x363, x364, x365, x366, x367;
bin x401, x402, x403, x404, x405, x406, x407;
bin x411, x412, x413, x414, x415, x416, x417;
bin x421, x422, x423, x424, x425, x426, x427;
bin x431, x432, x433, x434, x435, x436, x437;
bin x441, x442, x443, x444, x445, x446, x447;
bin x451, x452, x453, x454, x455, x456, x457;
bin x461, x462, x463, x464, x465, x466, x467;
bin x501, x502, x503, x504, x505, x506, x507;
bin x521, x522, x523, x524, x525, x526, x527;
bin x541, x542, x543, x544, x545, x546, x547;
bin x561, x562, x563, x564, x565, x566, x567;
bin x601, x602, x603, x604, x605, x606, x607;
bin x611, x612, x613, x614, x615, x616, x617;
bin x621, x622, x623, x624, x625, x626, x627;
bin x631, x632, x633, x634, x635, x636, x637;
bin x641, x642, x643, x644, x645, x646, x647;
bin x651, x652, x653, x654, x655, x656, x657;
bin x661, x662, x663, x664, x665, x666, x667;
$\endgroup$
  • $\begingroup$ PS My thanks to ffao for pointing out the error in my first attempt, which found no solutions. $\endgroup$ – Peter Taylor Oct 29 '16 at 6:48
  • 1
    $\begingroup$ I did a very simple (read: simple-minded) brute force which allowed any value to be used if it did not break the row-wise and/or column-wise set constraint until filling the last cell surrounding a clue whereupon it could use the one possible value or no value. It found 16 solutions very quickly (since they had the top row a permutation less than 1 2 3 5 6 7 4). It then went on for (untimed) maybe half an hour and found a total of 91 solutions. $\endgroup$ – Jonathan Allan Oct 29 '16 at 16:13
  • $\begingroup$ Thank you for this, I was worried this puzzle may have several solutions to it, and maybe I had presented it wrongly, because I am only remembering this puzzle from what's left of it in my memory. Is it possible that certain number sets can lead to a single solution? Also is it possible that by solving for all rows and columns to have no repeating numbers lead to a single solution? ie, even on rows and columns crossing the sums, no repeating number? $\endgroup$ – ThaBomb Nov 1 '16 at 10:10
  • 1
    $\begingroup$ @ThaBomb@, I can't immediately think of a way of answering those questions which is feasible with only a desktop computer. There are on the order of \$10^{17}\$ grids and slightly more potential sequences of 9 values for the clues, so I would say that it's plausible that there are puzzle instances with a unique solution, but finding one means finding a 9-dimensional hyperplane which touches the 280-dimensional simplex of puzzle instances at precisely one point, and I'm not sure how to tackle that other than by brute force. $\endgroup$ – Peter Taylor Nov 1 '16 at 15:33
2
$\begingroup$

This is more a comment response to The Vee then an answer but it could help out. In solving.

Here is the minimum value I could find of 269. The chart is coloured by how many times you count each square.

enter image description here

An interesting thing to note is the sum of the *2s and *4s always total 224 since if you place a number in the *4 square you cancel out 2 *2 squares.

So the actual key to minimizing the total is to minimize the values in the *1 squares. In this example you can see each boarder row has the numbers 1 to 5 in the *1 squares resulting in the lowest total.

Alternatively the highest value possible is 305 as shown below.

enter image description here

$\endgroup$
  • $\begingroup$ But in my comment I meant the values from the particular problem posted by the OP: (A, B, ..., I) being fixed at (15, 28, 44, 33, 36, 36, 46, 31, 19). $\endgroup$ – The Vee Oct 28 '16 at 16:07
  • $\begingroup$ Wait a minute, you're right of course, your argument really discredits my observation. So hmm, where's the fault...? $\endgroup$ – The Vee Oct 28 '16 at 16:10
  • $\begingroup$ Oh, I missed some signs. So the difference of (12*28 - sum of A:I) must equal the sum of the fields I mentioned. For example, in your second case, 336 - 305 = 31 = 3 + 6 + 3 + 7 (corners) + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1. Btw. your first case contains an error, there are two 4's in the last column. $\endgroup$ – The Vee Oct 28 '16 at 16:19
  • $\begingroup$ @thevee. Thanks for the heads up. I cant fix it for a while since i'm no longer at my computer. I think i can just swap the 4 and 5 in the bottom column so no change in total. $\endgroup$ – gtwebb Oct 28 '16 at 16:37
  • $\begingroup$ Turns out the minimum is 266 and the maximum 310. The former is for example: 3 5 1 6 2 7 4 / 7 – 7 – 3 – 5 / 2 3 5 4 6 7 1 / 6 – 4 – 4 – 6 and the rest filled to satisfy central symmetry. The latter is obtained by taking 8 minus everything. $\endgroup$ – The Vee Oct 28 '16 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.