TITLE: An algebraic riddle: The king's chest full of bags of gold coins
QUESTION [6 upvotes]: Consider following riddle in short form:
A king seeks a new treasurer and ask all the possible candidates the following question to check their logical abilities.
"There is a chest in front of you. The chest holds bags which contain the same amount of gold coins. The chest contains a total of coins between 150 and 200. The chest holds more than one bag and every bag holds more than one coin. If I'd tell you the total of coins in the chest, you'd be able to tell me how many bags the chest holds and how many coins each bag holds. How many coins are in the chest, how many coins are in each bag, and how many bags are in the chest?"
I've figured the answer out by using some kind of brute force of dividing the numbers between 150 and 200 to find the solution. But how would one solve this using algebra?

REPLY [5 votes]: Let's note $b$ the number of bags in the chest.
Let's note $c$ the number of coins in each bags.
Then we can easily deduce that the total number of coins $t$ in the chest is :
$$t = b*c$$ 
Furthermore we have $b>1,c>1$ as a condition.
Now the problem here is that if the King gives $t$ then we end up with one equation with two variables, meaning there can be multiple solutions :
For example, let say the King says "There is $180$ coins in the chest" which is $t=180$, now we end up with the following equation :
$$180 = b*c$$
For which there is multiple $(b,c)$ solutions :
$$(2,90),(3,60),(4,45), (5,36),(6,30),(9,20),(10,18),(12,15),(15,12),(18,10),(20,9,(30,6),(36,5),(45,4),(60,3),(90,2)$$
Here I chose $180$ to show there could be a lot of solutions. 
There could also be no solution if the King says a prime number between $150$ and $200$, which are :
$$151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199$$
Because the number of bags and coins is an integer and any of those numbers cannot be the product of two integers greater than $1$, there is no solution for those numbers.
EDIT : 

If I'd tell you the total of coins in the chest, you'd be able to tell me how >many bags the chest holds and how many coins each bag holds.

This means that the total number of coins gives a single $(b,c)$ solution. Which means :

$b=c$, or else $(b,c)$ and $(c,b)$ are two different solutions.
$b$ is a prime number, or else we could have more solutions.

Now with those clues and $t\in [150,200]$ we can deduce that :
$$t=169\text{ and } b=c=13$$