"A little pie costs 23, and a cake costs 49. Is it possible to reach 500$ selling both of the products?"
My attempt:
$\\23x + 49y = 500 \\23x + 49y \equiv 500 \pmod{23} \\0x + 3y \equiv 17 \pmod{23} \\3y \equiv 17 \pmod{23} \\y \equiv 21 \pmod{23}\\23x+49(21+23k)=500 \\ \text{then:}\\\\x=-23-49k \\y=21+23k$
I have already tested some values and it seems to work well, the thing is:
Is there a way to know if I can reach 500 by only using positive integers? If yes, then how? I want to do so because I guess he can't sell negative pies or negative cakes, If I am wrong, please let me any hints, thanks in advance.
you can write
$x=\frac {500-49y}{23}=21-2y+\frac {17-3y}{23}$,
Since $49y\leq500,y\leq10$,
therefore $-13\leq17-3y\leq17$,
I believe you can easily get the desired result.