How to index all elements of a finite field?
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 any element for example 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?
What is the logic behind this indexing? The more usual way is to associate $f(x)$ to $f(p) \in \mathbb{N}$, so $x^2$ corresponds to $9$ and $x+1$ corresponds to $4$.