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.

Jon Perry

perry@...

http://www.users.globalnet.co.uk/~perry/maths/

http://www.users.globalnet.co.uk/~perry/DIVMenu/

BrainBench MVP for HTML and JavaScript

http://www.brainbench.com