To add a little flavor to the other comment, write down the powers of 3, starting with 3^0 = 1:

1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, 177147, 531441, …

The units digit cycles through 1, 3, 9, 7 and then starts over again. So, you could say that when x=0 (4), 3^x = 1 (10) and when x=1 (4), 3^x = 3 (10), and so on for the 4 different values of x mod 4. But if 3^x is 1 mod 10, then 3^x is also 1 mod 5, and that’s what they are using here.