From: Ostap Bender on
On Jun 4, 8:32 am, recoder <kurtulmeh...(a)gmail.com> wrote:
> Dear All,
> I have to write a program to compute:
> 2^q mod(p) and
> 2^(q-3) mod (p) where q and p are very large primes.
> I plan to use the "power-mod" algorithm to compute the 2 expressions seperately.
> Is there a way to compute
> 2^q mod(p) and derive 2^(q-3) mod (p) or vice versa ???

Yes. Compute 2^(q-3) and then multiply it by 8 mod(p) to get 2^q
mod(p).

Is this homework for your high school math class?