Prove that, for all $n\in{Z}$, if $3\mid{n}$ or $18\mid{n-7}$, then there exists $m\in{Z}$ such that $(n^2-9m)(n-9m+2)=0$.
I tried splitting this up into two cases, one where $3\mid{n}$ in which case $n=3k$ for some $k\in{Z}$, and the same with $18\mid{n-7}$. Then, I'm substituting the $k$ values into $(n^2-9m)(n-9m+2)=0$. But I'm not sure where I'm going with my method.
Any help is appreciated, thanks!
You are on the right track. For $n \mid 3$, we have $n=3k$. Then we can choose $m=k^2$, in which case $n^2-9m=0$, thereby making the product zero.
When $18 \mid n-7$,then $n=7+18t$, see if you can choose $m$ appropriately now. (Hint: go for the other term)