can someone please tell me the difference btw modular exponentiation and fast exponentiation or are the two same? An example would be helpful.

Thanks in advance:)

They are very similar.

Fast exponentiation is used to compute a^n in O(\log n)(assuming the number fits in a word)

modular exponentiation is used to compute a^n\pmod M in O(\log n)

The technique used to compute the answer is same in both

2 Likes

Gotcha.Thanks:)