# How do you solve 5x + 9y = 181?

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?

Mark44
Mentor
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?
Look up Diophantine equation (http://en.wikipedia.org/wiki/Diophantine_equation) and the Chinese remainder theorem.

jtbell
Mentor
you can choose any b and get a corresponding a.
Not if a and b are both required to be integers.

I noticed in the particular example I proposed that the solutions to y are those integers that differ from 9 by a multiple of 5 (or zero). Thus, the solutions to y are 4, 9, 14, and 19 which is an arithmetic progression modulo 5. As far as x goes, it seems a little more tricky: x differs from 5 by integers that are multiples of 3, which is a divisor of 9. 9 seems to be the limiting agent here.

Oh, duh.......all the x's are in an arithmetic progression congruent 2 modulo 9: 2, 11, 20, 29. Why it starts at 2 is a little perplexing.

HallsofIvy
• 