If a = 8 (mod 9), then a must be 2 (mod 3), so we can forget about that equation.
a = 4 (mod 5)
a = 1 (mod 7)
a = 8 (mod 9)
I'm going to use the Chinese Remainder Theorem, which is a bit difficult to exaplain, but there are some good videos on youtube.
Starting with mod 5.
x = 0 (mod 7) and (mod 9) but 4 (mod 5).
x = 7*9*n = 4 (mod 5)
This works when n = 3, x = 189.
Then, mod 7.
x = 0 (mod 5) and (mod 9) but 1 (mod 7).
x = 5*9*n = 1 (mod 7).
This works when n = 5, x = 225.
Then, mod 9.
x = 0 (mod 5) and (mod 7) but 8 (mod 9).
x = 5*7*n = 8 (mod 9).
This works when n = 1, x = 35.
Finally, we add everything up.
189 + 225 + 35 = 449
We can make it smaller by doing 449 - 5*7*9 = 134.
=^._.^=