Is this of any use?
- When conducting prime tests via Fermat's or something more soph.;
Calculate 2^n = 1 + kn and also calculate k.
Now 3^n = (3/2)^n * 2^n = (3/2)^n.[1+kn]
which effectively allows us to calculate k', i.e. the k' in 3^n = 1 + k'n,
and this in turn allows us to determine the mod relations of 3^n rapidly, as
we generally only need to calculate the last few digits.