Grandma has just finished baking a large rectangular pan of brownies. She is planning to make rectangular pieces of equal size and shape, with straight cuts parallel to the sides of the pan. Each cut must be made entirely across the pan. Grandma wants to make the same number of interior pieces as pieces along the perimeter of the pan. What is the greatest possible number of brownies she can produce?
$\textbf{(A)} ~24 \qquad\textbf{(B)} ~30 \qquad\textbf{(C)} ~48 \qquad\textbf{(D)} ~60 \qquad\textbf{(E)} ~64$
Let the side lengths of the rectangular pan be $m$ and $n$. It follows that $(m-2)(n-2) = \frac{mn}{2}$, since half of the brownie pieces are in the interior. This gives $2(m-2)(n-2) = mn \iff mn - 4m - 4n + 8 = 0$. Adding 8 to both sides and applying [Simon's Favorite Factoring Trick](https://artofproblemsolving.com/wiki/index.php/Simon%27s_Favorite_Factoring_Trick), we obtain $(m-4)(n-4) = 8$. Since $m$ and $n$ are both positive, we obtain $(m, n) = (5, 12), (6, 8)$ (up to ordering). By inspection, $5 \cdot 12 = \boxed{\textbf{(D) }60}$ maximizes the number of brownies.
~ ike.chen