The brute force method proposed in the article is so strangely obscure.<p>Here's a very simple alternative:<p><pre><code> for m in range(0,100):
for w in range(0,100):
for c in range (0,100):
if m + w + c == 100 and 3*m+2*w+.5\*c==100:
print(m,w,c)</code></pre>
Does this technique apply if the dimension of the null space of the linear transformation is greater than 1? In other words, if there is more than 1 free variable, can you still use the Smith normal form of the matrix to find a bijection from the integers to the solution set?<p>Edit: related follow up: any chance this technique is a good fit for enumeration of [Magic Squares][0] of a given order?<p>[0]: <a href="https://en.wikipedia.org/wiki/Magic_square" rel="nofollow">https://en.wikipedia.org/wiki/Magic_square</a>
Interestingly, o1-preview gets all 7 solutions in 18 seconds. It also makes short work of Bachet’s Four Weights Problem as recounted at <a href="https://ninazumel.com/blog/2024-09-29-four-weights/" rel="nofollow">https://ninazumel.com/blog/2024-09-29-four-weights/</a> .<p>Pretty smart parrot.
Am I stupid or this is solvable with pen and paper?<p>The word problem directly translates to this system of diophantine equations:<p><pre><code> (i) { x + y + z = 100
(ii) { 6x + 4y + z = 200
</code></pre>
Replacing z in (ii) using (i) yields:<p><pre><code> (ii) <=> 6x + 4y - x - y + 100 = 200 <=> 5x + 3y = 100
</code></pre>
Which is solvable with the usual method.
In R `nnls` (nonnegative least squares) does not guarantee integrality but in this case does give one solution and it happens to be integral: `library(nnls); nnls(A, b)`