# Satisfying an equation in natural numbers

Mathematics Asked by Luyw on November 26, 2020

I am playing a game where I can gain xp from crafting certain things using some material. The xp is given by$$E=250a+375b+500c$$
$$a$$ represents how many sets of $$50$$ of the material I will put in, $$b$$ of $$75$$ units, and $$c$$ of $$100$$ units. Thus, the total quantity I am putting is
$$Q=50a+75b+100c$$
This is divisible by $$25$$, so I know that if the quantity I have is $$Q’=25q+r$$, then I will work with $$Q=Q’-r$$.
It can be seen that $$E=5Q$$ for any choice of $$a$$, $$b$$, and $$c$$ that satisfies the $$Q$$ equation.

Given $$Q$$, how can I find $$(a,b,c)$$ that satisfy $$Q=50a+75b+100c$$?

Presumably you are asking for solutions in nonnegative integers. As pointed out by Morgan Rodgers in their comment, you can set $$Q=25S$$ and $$(a,b,c)=(25u,25v,25w)$$ and solve $$S=2u+3v+4w$$.

Note that $$S$$ and $$v$$ are either both even or both odd. If $$S$$ is even, then write $$S=2T$$ and $$v=2x$$ and solve $$T = u+3x+2w$$; if $$S$$ is odd, then write $$S=2T+3$$ and $$v=2x+1$$ and solve $$T=u+3x+2w$$.

In either case, you can choose any values for $$x$$ and $$w$$ such that $$3x+2y le T$$, and then $$u=T-3x-2y$$ is valid and uniquely determined.

Correct answer by Greg Martin on November 26, 2020