divisibility of an expression by 30 let $g$ be a natural number how to show that $30$ divides $(-8 g^5+20 g^4-50 g^3+115 g^2-167 g+90)$? 
my guess:
$30$ divides $90$ so it is enough to show that $30|-8 g^5+20 g^4-50 g^3+115 g^2-167 g = g(-8 g^4+20 g^3-50 g^2+115 g-167) $ now if $30|g$ we are done, otherwise we have to show that
$30|-8 g^4+20 g^3-50 g^2+115 g-167$ , I don't know how to go further..
 A: Note that for any $n\in\mathbb{Z}$, 
$$30\mid n\iff 2\mid n\text{ and }3\mid n\text{ and }5\mid n.$$
Then note that
$$-8g^5+20g^4-50g^3+115g^2-167g+90\equiv0+0+0+g^2+g+0\equiv g+g\equiv 0\bmod 2$$
because, by Fermat's Little Theorem, $g^2\equiv g\bmod 2$. Similarly,
$$-8g^5+20g^4-50g^3+115g^2-167g+90\equiv g^5+2g^4+g^3+g^2+g+0\equiv $$
$$g+2g^2+g+g^2+g+0\equiv 0\bmod 3$$
because $g^3\equiv g\bmod 3$, and
$$-8g^5+20g^4-50g^3+115g^2-167g+90\equiv 2g^5+0+0+0+3g+0\equiv $$
$$2g+0+0+0+3g+0\equiv 0\bmod 5$$
because $g^5\equiv g\bmod 5$.
Thus, we have shown that any number of the form $-8g^5+20g^4-50g^3+115g^2-167g+90$ is divisible by 2, 3, and 5, and therefore is divisible by 30.
A: The polynomial is divisible by 30 iff it is divisible by 2, 3, and 5.
The straightforward approach is then to simply evaluate the polynomial at {0,1} modulo 2, {0,1,2} modulo 3, and {0,1,2,3,4} modulo 5, and verify you get 0 in each case. 
A: Hint:  Show that each of $2,3,5$ divides your expression.  Lets do $2$ first:
We can take out all the terms which are already divisible by $2$, and look at the remainder.  (That is look modulo 2)  We have $$115g^2-167g\equiv g^2-g.$$  Then if g is odd, this is divisible by two, and same thing if $g$ is even.  Now do the same for $3$ and $5$.
A: HINT $\rm\ \mod\ 2\!:\ f\: \equiv\: g^2-g,\ \ mod\ 5\!:\ f\:\equiv\: 2\ (g^5-g),\:$ and $\rm\ mod\ 3\!:\ f(\pm1)\equiv\: 0\:\equiv\:f(0)\:.$
