# 2008 iTest Problems/Problem 13

## Problem

In preparation for the family's upcoming vacation, Tony puts together five bags of jelly beans, one bag for each day of the trip, with an equal number of jelly beans in each bag. Tony then pours all the jelly beans out of the five bags and begins making patterns with them. One of the patterns that he makes has one jelly bean in a top row, three jelly beans in the next row, five jelly beans in the row after that, and so on: $$\begin{array}{ccccccccc}&&&&*&&&&\\&&&*&*&*&&&\\&&*&*&*&*&*&&\\&*&*&*&*&*&*&*&\\ *&*&*&*&*&*&*&*&*\\&&&&\vdots&&&&\end{array}$$

Continuing in this way, Tony finishes a row with none left over. For instance, if Tony had exactly $25$ jelly beans, he could finish the fifth row above with no jelly beans left over. However, when Tony finishes, there are between $10$ and $20$ rows. Tony then scoops all the jelly beans and puts them all back into the five bags so that each bag once again contains the same number. How many jelly beans are in each bag? (Assume that no jelly bean gets put inside more than one bag.)

## Solution

Note that the first row has $1$ jellybean and the second row has $3$ jellybeans, so the $n^\text{th}$ row has $1+2(n-1)$ jellybeans. That means the total number of jellybeans is $$\frac{1}{2} \cdot n(1+2(n-1)+1)$$ $$\frac{1}{2} \cdot n(2 + 2n - 2)$$ $$n^2$$ Since Tony finishes with more than $10$ but less than $20$ rows, $10 < n < 20$. He was able to evenly divide the jellybeans into five bags, so $n^2$ is a muliple of five. The only value of $n$ that satisfies the conditions is $15$, so each bag has $\tfrac{225}{5} = \boxed{45}$ jellybeans.