Based on the consideration in the previous section, we obtain the following algorithm.

- Find by (17) or (19).
- The initial values and are immediately determined by using (11) and (12).
- Calculate rhs of (21), then get and by (22).
- Find and in time by (23) or (25) recursively
for each
*i*. - Repeat 3-4 until
*i*=*n*. - Obtain
*n*-digit number by (5).