Obtain number of pieces in jigsaw puzzle from its ratio of border pieces My daughter was given an intriguing math assignment. I found a solution, but I'm curious about a more elegant approach.
"A jigsaw puzzle of M by N pieces has exactly 8% of border pieces. What are M and N ?"
The pieces are arranged in a perfect rectangular grid, and there's no funny stuff with irregular shapes. Therefore, the total amount of pieces is simply $M.N$ ; whereas the pieces on each of the 4 edges can be counted as $2.(M+N)$, but that counts the four corners twice. Correcting for this, my equation becomes $2.(M+N)-4=(8\%).M.N$ which simplifies to :
$$M+N-2 = \frac{M.N}{25}$$
That's where the elegance stops and my crude guesswork begins, while the assignment explicitly asks not to use trial-and-error.
Focusing on the fact that M and N need to be integers, I briefly pondered $25|M$ but I concluded that won't yield any viable solutions for $N$. So I went for the more balanced constraints $5|M\;\&\;5|N$. I decided to rewrite the variables as $M=5.m$ and $N=5.n$ to ultimately get to the equation :
$$5.(m+n)-2=m.n$$
I believe that "Integer calculus" exists as a branch of mathematics, but it is entirely shrouded in mystery to me. So I resorted to brute-force, and I listed all the integer multiples of 5, minus 2, to represent the left side of the equation : $13,18,23,28,33,...$ Then I tried to factor each of these numbers into $m.n$ to make the equation work out.
As is to be expected, this could be charted as a race between a steep linear graph, and a parabole. When aiming for a nearly square jigsaw puzzle by choosing $m\approx n$, the five-fold sum at the left of the equation, starts out much larger than the product at the right. I found the parabole to be overtaking the straight line around $m+n=21$ without yielding an integer solution ; from there on, the value of the parabole becomes way too large to ever obtain any further solutions.
However, not all the factorings of my series $13,18,23,28,33,...$ have a near-square aspect ratio. When the product can be factored into more than two divisors, the aspect ratio $m/n$ can be tailored at will. By going for $m<<n$ (which a physicist might call sacrificing surface area for perimeter length), additional paraboles for $m.n$ appear on the chart, intersecting the linear graph for $5.(m+n)-2$ elsewhere. This eventually led me to an integer solution for $m$ and $n$, which I converted back to $M$ and $N$ to get to a sizeable jigsaw puzzle.
I can't imagine that this would be the approved method, so I might actually flunk my daughter's assignment. How would a real mathematician handle this task ?

Concerning the equation $5(m+n)-2=mn$, here is an approach: we have
$$n = \frac {5m-2}{m-5}=5+\frac{23}{m-5}$$
This shows that $(m-5)\mid 23$.
Since $23$ is prime, $m-5 = 1$ or $23$. (or $-1$ or $-23$, but these values don't give positive $m$ or $n$)
We thus have $m = 6$ or $28$.
For $m=6$, $n=28$. For $m=28$, $n=6$.
EDIT: by the way there are solutions for $25\mid M$ which you can similarly find:
$M=50, N=48$ and $M=600,N=26$.
