Sorry for the misleading title. My question is: how do you solve Xa + Yb = Z, where X, Y, and Z are positive integer constants and a and b are positive integer variables? For example, consider 5x + 9y = 181. The problem is: solve for all possible answers for x and y, where x and y are both positive integers. Is it just trial and error or is there some equation that would lead me directly to all the solutions?