https://www.gregmat.com/problems/quant?problem=the-remainder-when-812-2-is-divided-by-7-is
Is it possible to do this by finding the remainder pattern for 8^x-2?
E.g.
(8^1 -2) mod 7 = 6
(8^2 -2) mod 7 = 6
The cycle repeats immediately (cycle length 1) so all remainders will be 6.