Candy Grid Arrangement
Sally has a bagful of candy. She arranges it into an $ a $ by $ b $ grid, but she has $ 2a+b $ candies leftover. Her big sister Rita comes along and says, "I can do better than that!" Rita neatly arranges the candies into a $ 5a-4 $ by $ \frac{b-1}{3} $ grid and has none leftover. What is the maximum number of candies in Sally's bag?
- 1
- 2
- 3
- +
- 4
- 5
- 6
- -
- 7
- 8
- 9
- $\frac{a}{b}$
- .
- 0
- =
- %
- $a^n$
- $a^{\circ}$
- $a_n$
- $\sqrt{}$
- $\sqrt[n]{}$
- $\pi$
- $\ln{}$
- $\log$
- $\theta$
- $\sin{}$
- $\cos{}$
- $\tan{}$
- $($
- $)$
- $[$
- $]$
- $\cap$
- $\cup$
- $,$
- $\infty$
Solution
In Sally's arrangement, the number of candies is $ ab+2a+b $. In Rita's arrangement, the number of candies is $ \left(5a-4\right)\left(\frac{b-1}{3}\right) $. The number of candies didn't change, so these two expressions are equal. Therefore, \begin{align*}
ab+2a+b&=(5a-4)\left(\frac{b-1}{3}\right) \quad \Rightarrow \\
3ab+6a+3b&=(5a-4)(b-1)\quad \Rightarrow \\
3ab+6a+3b&=5ab-4b-5a+4\quad \Rightarrow \\
0&=2ab-7b-11a+4\quad \Rightarrow \\
-4&=b(2a-7)-11a\quad \Rightarrow \\
-4+\frac{11}{2}(7)&=b(2a-7)-\frac{11}{2}(2a-7)\quad \Rightarrow \\
\frac{-8}{2}+\frac{77}{2}&=\left(b-\frac{11}{2}\right)(2a-7)\quad \Rightarrow \\
69&=(2b-11)(2a-7).\end{align*}The prime factorization of $ 69 $ is $ 3\cdot 23 $. So we have the following possibilities. \begin{array}{c|c|c|c|c|c}
2a-7 & 2b-11 & 2a & 2b & a & b \\ \hline
1 & 69 & 8 & 80 & 4 & 40 \\
3 & 23 & 10 & 34 & 5 & 17 \\
23 & 3 & 30 & 14 & 15 & 7 \\
69 & 1 & 76 & 12 & 38 & 6
\end{array}We know from above, since Rita's arrangement must have integral dimensions, that $ b-1 $ is divisible by $ 3 $. A check shows that the pairs $ (a,b) $ that don't work are $ (5,17) $ and $ (38,6) $. Thus we have either $ (a,b)=(15,7) $ or $ (a,b)=(4,40) $. There are $ ab+2a+b $ candies. In this first case we have $ (15)(7)+2(15)+7=142 $ candies. In the second case there are $ (4)(40)+2(4)+40=208 $ candies. Thus the maximum number of candies that could be in Sally's bag is $ \boxed{208} $.