5. The lengths $a, b$ and $c$ of the edges of a wooden rectangular prism are natural numbers greater than 2, and it also holds that $a=b$. We paint the prism and then cut it into unit cubes. The number of unit cubes that have exactly two painted faces is 16 more than the number of unit cubes that have no painted faces. Determine the lengths of the edges of the prism.

## 51st Mathematical Competition for High School Students in Slovenia

Optional Competition, April 4, 2007

## Problems for 4th Year
III/5. On the edge of length $a$, there are $a-2$ unit cubes that have exactly two faces painted, and on the edge of length $c$, there are $c-2$ such cubes. Since the cuboid has 8 edges of length $a$ and 4 edges of length $c$, the total number of cubes with two painted faces is $8(a-2)+4(c-2)$. The cubes with no painted faces are located in the interior and their number is $(a-2)(a-2)(c-2)$. The following must hold:

$$
8(a-2)+4(c-2)=16+(a-2)^{2}(c-2)
$$

We can simplify the expression to $0=32+a^{2} c-4 a c-2 a^{2}$. From this, we can express $a c(a-4)=$ $2\left(a^{2}-16\right)=2(a-4)(a+4)$. If $a=4$, the expression holds for any natural number $c$. Otherwise, we can divide by $a-4$ and get $a c=2 a+8$ or $c=2+\frac{8}{a}$. Therefore, $a$ must be a divisor of 8, and since $a \geq 3$ and $a \neq 4$, it follows that $a=8$ and $c=3$.

Equation (4) can also be solved differently by setting $x=a-2$ and $y=c-2$. Then we get $8 x+4 y=16+x^{2} y$ or

$$
0=x^{2} y-4 y+16-8 x=y(x-2)(x+2)+8(2-x)=(x-2)(y(x+2)-8)
$$

Then either $x=2$ and $y$ is arbitrary, or $y(x+2)=8$. From this, for $x \neq 2$, the expression $x+2$ can be 8, in which case $y=1$.

For the edges of the cuboid, either $a=4$ and $c$ is any number, or $a=8$ and $c=3$.

Writing the number of cubes $z$ with two and no painted faces 1 point Equation (4) (or an equivalent)

1 point

Factorization $a c(a-4)=2(a-4)(a+4)$ or $(x-2)(y(x+2)-8)=0$ (or similar) 2 points

![](https://cdn.mathpix.com/cropped/2024_06_07_a8720c28cfa2c07912d2g-12.jpg?height=52&width=1633&top_left_y=2321&top_left_x=220)

Conclusion that $a$ (or $c-2$ or $x+2$ or $y$) is a divisor of 8 ...............................

![](https://cdn.mathpix.com/cropped/2024_06_07_a8720c28cfa2c07912d2g-12.jpg?height=51&width=1633&top_left_y=2419&top_left_x=220)

(If the contestant introduces $x$ and $y$ (or similar) and solves the problem completely but does not write the result for $a$ and $c$, award 6 points.)