I would like to assign an integer corresponding to element of a finite field $GF(p^m)$, where $p^m\in[ {13^2,3^5, 131,137,139,251}] $
MWE:
F.<x> = GF(3^5, impl='givaro')
THe elements of GF(3^5) are 0,1,2,x,x^2 etc, we would like to indexing each element such as $0-->0, 1-->1,2-->2,x-->3, x^2--4$ etc. Not only that, if I call x^2 it should rerun 4 and conversely.
This process should work for the field order prime $p^m, m=1$ also. How can I do this?