Koeller rectangle question. This is a question that appeared on the 2017 CEMC Galois math contest (which took place a few weeks ago):
A Koeller rectangle:


*

*Is a rectangle $m\times n$, n being a whole number with $m \geq 3$ and $n \geq 3$;

*has parallel lines on its side dividing the rectangle into $1\times 1$ squares;

*The squares on the edges are white and the ones inside are shaded.


The figure (see attached) is an example of a Koeller rectangle where $m= 8$ and $n= 6$.
Given a Koeller rectangle, r is the ratio between the shaded area and the non shaded area (shaded/non-shaded)
Determine all the possible prime numbers p for which there exists exactly 17 positive values for $u$ for Koeller rectangles with $n=10$ and $r=\frac{u}{p^2}$
Question (in French), and image of example Koeller rectangle:
https://i.stack.imgur.com/x8eC4.jpg
I answered that there are no such primes that satisfy the given conditions, but I'm almost certain that's incorrect. Could someone please explain to me how to solve this question?
 A: It is simpler than it looks :)
$$r = \frac{(m-2)(n-2)}{2*(m+n-2)} $$
for n = 10 it gives
$$r = \frac{4*(m-2)}{m+8} $$
$$u = r*p^2 = 4 * p^2 * \frac{m-2}{m+8} = 4 p^2 - \frac{40 p^2}{m+8}$$
The first term is an integer, we need the second one to be so too. So we need M = m+8 to be a divisor of $40p^2$, which itself can be decomposed as follows 2,2,2,5,p,p.
All the possible divisor values for M are
$1,2,4,5,8,10,20,40,$
$p,2p,4p,5p,8p,10p,20p,40p,$
$p^2,2p^2,4p^2,5p^2,8p^2,10p^2,20p^2,40p^2$
That s a total of 24 divisors possible. Remove the ones for which $M<=11$, i.e. $1, 2, 4, 5, 8, 10$, because that would mean $m<=3$. That leaves us with 18 divisors .
For p = 2 and 5 we have lots of duplicates and the total numbers of unique divisors are 6 and 15. For p = 3, we have many values below 11. For primes p above 11 all the 18 divisors are unique (remember p is prime).
The only one that works is p=7, because then the divisors p in the list above disappears (again based on the constraint that M must be >= 11).
In summary
$p=2: 6 divisors $
$p=3: 15 divisors $
$p=5: 10 divisors $
$p=7: 17 divisors $ !!!
any prime p>=11: 18 divisors 
Only one solution, p=7
Glad I could help :)
