# Revision history [back]

### How to access serial number corresponding to each element in $GF(2^3)$?

I would like to access serial number corresponding to each element in $GF(2^3)$? Corresponding to each serial number, I can access the element in $G(2^3)$ as follows:

F.<x> = GF(2^3, name='x', modulus=x^3 + x^2 + 1)
for i in range(2^3):
print i,'=>',F.fetch_int(i)


This provides :

0 => 0
1 => 1
2 => x
3 => x + 1
4 => x^2
5 => x^2 + 1
6 => x^2 + x
7 => x^2 + x + 1


I would like to get the reverse process which will provide seral number corresponding to each element in $(2^3)$, that is,

0 => 0
1 => 1
x => 2
x + 1 => 3
x^2 => 4
x^2 + 1 => 5
x^2 + x => 6
x^2 + x + 1 => 7


Is there any such way?