inverse of a, 1<=a^(-1)<=p-1, aa^(-1)=1(mod p).

rather than compute a^(-1) afresh each time it is needed, the inverses should be computed once and stored. p is a prime.

Write a program to store the inverses of the non-zero elements of F in an array of length p-1. Find the inverses by testing, for each a in the range 1<=a<=p-1, all values of b in the range 1<=a<=p-1 until you find one which works and then store it. Describe any very simple modification to speed up this procedure.