A little rewriting could be beneficial.
502 - 25y = 29*17 + 9 - 29y + 4y = 29(17 - y) + (9 + 4y)
George has a collection of old stamps. Some are worth 29 cents, the rest are worth a quarter. Their total value is $5.02. How many 29 cent stamps does George have?
Let be the number of 29 cents stamps and let be the number of 25 cents stamps. Then,
Multiplying by 100 to rid the equation of decimals yields
Solving for x yields
I know is an integer, so is also an integer. I also know is divisible by (else isn't an integer). How would I use this knowledge to find ?
Since x and y must be integers, this is a "Diophantine" equation. There is a standard way of solving them.
29x+ 25y= 502.
25 divides into 29 once with remainder 4: 29- 25= 4. 4 divides into 25 6 times with remainder 1: 25- 6(4)= 1. Replacing that "4" by "29- 25", 25- 6(29- 25)= 7(25)- 6(29)= 1. Multiplying each side by 502, 3514(25)- 3012(29)= 502. One solution to that equation is x= -3012, y= 3514. Of course, here, each number must be positive so that does not satisfy this problem. However, for any integer, k, x= -3012+ 25k, y= 3514- 29k is also a solution: 29(-3012+ 25k)+ 25(3514- 29k)= 29(-3012)+ 29(25)k+ 25(3514)- 25(29)k and the terms involving k cancel.
25 divides into 3012 120 times so -3012+ 25(121)= 13 is positive. 29 divides into 3514 121 times so 3514- 29(121)= 5 is still positive. That is the only solution to the equation that has both x and y positive and so is the solution to this problem.
Hello, NOX Andrew!
.[1]
Here is a very primitive method . . .
We have: .
Solve for .[2]
Since is an integer, must be a multiple of 25.
Then: .
Solve for .[3]
Since is an integer, must be a multiple of 4.
This happens when
Substitute into [3]: .
Substitute into [2]: .
Substitute into [1]: .