Gapplet

Given polynomials f and d in Z/pZ[X], with f nonzero and d irreducible, we determine the order of f in the multiplicative group of Z/pZ[X]/(d), that is, the smallest positive exponent i such that fi = 1.
Notice that then 1/f = fi-1 in Z/pZ[X]/(d).

Input p,  e.g., 7
Input d
e.g., X^5-3*X-1
 
Input f
e.g., X-2
 
Compute the order of f 
in Z/pZ[X]/(d), 
 
period and inverse of f 
Observe that the period always divides pn-1.