Let $n$ be a positive integer. If the equation $2 x+2 y+z=n$ has 28 solutions in positive integers $x, y$ and $z$, determine the possible values of $n$.

#
Solution

First, notice that if $x$ and $y$ are defined, there is only one possible choice for $z$, and moreover, $z$ and $n$ have the same parity. Consider the following cases:

i) The number $n$ is even, i.e., $n=2i$. Thus, we must have $z=2j$ and

$$
\begin{aligned}
2x + 2y + z & = n \\
x + y & = i - j.
\end{aligned}
$$

We then have the following $i-j-1$ possibilities for the pair $(x, y)$:

$$
(1, i-j-1), (2, i-j-2), \ldots, (i-j-1, 1)
$$

Since we must have $1 \leq i-j-1 \leq \frac{n-4}{2}$, for a fixed even $n$, we have

$$
\frac{n-4}{2} + \frac{n-3}{2} + \ldots + 1 = \frac{(n-4)(n-2)}{8}
$$

solutions.

ii) The number $n$ is odd, i.e., $n=2i+1$. Thus, we must have $z=2j+1$ and

$$
\begin{aligned}
2x + 2y + z & = n \\
x + y & = i - j.
\end{aligned}
$$

We then have the following $i-j-1$ possibilities for the pair $(x, y)$:

$$
(1, i-j-1), (2, i-j-2), \ldots, (i-j-1, 1)
$$

Similarly to the previous case, we must have $1 \leq i-j-1 \leq \frac{n-3}{2}$, and for a fixed odd $n$, we have

$$
\frac{n-3}{2} + \frac{n-5}{2} + \ldots + 1 = \frac{(n-3)(n-1)}{8}
$$

solutions.

Therefore,

$$
\begin{aligned}
& \frac{(n-4)(n-2)}{8} = 28 \text{ or} \\
& \frac{(n-3)(n-1)}{8} = 28
\end{aligned}
$$

The only positive solutions to the above equations are $n=17$ and $n=18$.