Simplification when only calculating mod and modulus is 3. 2^(2*n) * x mod 3 = x mod 3. Add all digits and calculate mod 3 of sum.
Simplification when only calculating mod and modulus is 3. 2^(2*n) * x mod 3 = x mod 3. Add all digits and calculate mod 3 of sum.