Find $A = x - y + z$ if $3x + 5y + 7z = 29$ and $x , y , z \in \mathbb{Z}^+$ I've found the answer by trial and error $(x = 4 , y=2,z=1) \Rightarrow$ $A = 3$. I tried to solve it using modular arithmetic but it didn't work .
$$3x + 5y + 7z = 29 $$
$$ 3x + 5y+7z \equiv 29  \mod 3$$
$$ 2y +z \equiv 2 \mod 3 $$
$$ y= -k , z=2k + 2$$
putting $ y= -k , z=2k + 2$ to original equation leads to $x = -3k + 5$ . Then $A = -3k+5 +k +2k+2 = 7$ . What's wrong about my answer? 

You don't get $z = 2k + 2$. you get $z \equiv 2k + 2 \mod 3$.
Or $z = 2k + 2 + 3M$.
Plugging that into the equation we get
$3x -5k + 2k + 14k + 14 + 21M = 29$ so
$3x = -9k + 15 + 21M$ or 
$x = -3k + 5 + M$ for some integer $M$. As $M$ can be any integer that is pretty useless but let's continue.
Plugging $x = -3k + 5 + M; y = -k; z = 2k +   2 + 3M$ we get:
$A = -3k + 5 + M +k + 2k +2 + 3M  = 7 + 4M$
In this case it turns out that $M = -1$.
$A \equiv 7 \mod 4$ is not entirely useless however.
But solving $\mod 3$ can only give you at best a solution $\mod 3$.  That's not good enough.
