Artificial intelligent assistant

An algebraic riddle: The king's chest full of bags of gold coins 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?

Suppose there were $182$ coins. That could be $14×13$ or $26×7$, among other things. So we could not tell how many bags or how many coins per bag there are.

Suppose there were $187$ coins. That can only be $11×17$, the product of two primes. But which is $11$, the number of bags or the number of coins per bag?

To avoid these ambiguities, you need a number of coins that is the product of two identical primes, meaning it's the square of this common prime. There is only one such number between $150$ and $200$.

Apparently the king is not triskaidekaphobic ... .

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f8ceafa94fd61155d439aaf54ed3b0be