[This page is auto-generated; please prefer to read the article’s PDF Form.]
A trivial algorithm is to sequentially compute a2,a3,…,ab−1,ab by multiplying an ax term with a to obtain ax+1. In the common-structure of last section, this means initializing x to 1 and increasing it by 1 in each iteration. As x is updated to x + 1, r can be updated to (modulo n):
|
The following method implements this algorithm:
This algorithm requires b− 1 multiplications, and so becomes inefficient as b becomes larger.
Copyright © 2021 Nitin Verma. All rights reserved.