Update
Finally got the background origin of this. And a more comprehensive article is here. This has has a total of 310 combinations that add up to 33.
And this IS more interesting way of highlighting.
OP
Saw this math puzzle on Twitter, which asks with the given magic square to find 33 different ways of adding 4 of its cells to 33.
I tried to use Solve
Solve[x1 + x2 + x3 + x4 == 33 && x1 < x2 < x3 < x4, {x1, x2, x3, x4}, { x1, x2, x3, x4} ∈ {1, 2, 3, 4, 6, 7, 8, 9, 10, 13, 14, 15}]
Solve[x1 + x2 + x3 + x4 == 33 && x1 < x2 < x3 < x4, {
x1 ∈ {1, 2, 3, 4, 6, 7, 8, 9, 10, 13, 14, 15},
x2 ∈ {1, 2, 3, 4, 6, 7, 8, 9, 10, 13, 14, 15},
x3 ∈ {1, 2, 3, 4, 6, 7, 8, 9, 10, 13, 14, 15},
x4 ∈ {1, 2, 3, 4, 6, 7, 8, 9, 10, 13, 14, 15}
}
]
Neither worked.
2nd problem is how to use the solutions to highlight it like in the graph? Should be easy after we obtain all solutions. Something like
m = {
{1, 14, 14, 4},
{11, 7, 6, 9},
{8, 10, 10, 5},
{13, 2, 3, 15}
}
Grid[m /. {"answers"}, Frame -> All]
Thanks.
Sort/@Select[DuplicateFreeQ]@IntegerPartitions[33, {4}, {1, 2, 3, 4, 6, 7, 8, 9, 10, 13, 14, 15}]
$\endgroup$magic square
has 33 different ways of adding 4 numbers to 33. Couldn't find the OP now. $\endgroup$