When a positive number nnn is divided by 7 and leaves a remainder 2, we can
express this as:
n=7k+2n=7k+2n=7k+2
for some integer kkk. When 3n3n3n is divided by 7, substitute nnn:
3n=3(7k+2)=21k+63n=3(7k+2)=21k+63n=3(7k+2)=21k+6 Since 21k21k21k is divisible
by 7, the remainder when 3n3n3n is divided by 7 is the remainder when 6 is
divided by 7, which is 6. Thus, the remainder is 6. This matches the
standard remainder calculation approach for multiplication in modular
arithmetic.