I am interested in defining / extending gcd
(and possibly euclidean algorithm) over the finite field $\mathbb{Z}_p$ (that is over integers modulo a prime $p$).
The problem I have in extending this notion to this finite field is how to define a sensible modulo operation (and implemenent it) since all elements have inverses and division is exact.
For example for the field of rationals $\mathbb{Q}$ a sensible and non-trivial extension of gcd
exists and in fact makes use of the gcd
over integers.
ie:
$$gcd_{\mathbb{Q}}(\frac{p_1}{q_1},\frac{p_2}{q_2}) = \frac{gcd_{\mathbb{Z}}(q_2p_1, q_1p_2)}{q_1q_2}$$
Can something similar be done for finite field $\mathbb{Z}_p$?
Of course, the trivial definition:
$$gcd_{\mathbb{Z}_{p}}(n_1,n_2) = 1$$
can be used (since gcd
is not uniquely defined but involves multiplication with a unit of the ring) but I was hoping for something less trivial, for example
$$gcd_{\mathbb{Z}_{p}}(n_1,n_2) = min_{\mathbb{Z}}(n_1,n_2)$$
Is this valid as an extended defintion of gcd
over the finite field?
If this is already answered elsewhere, please point me to the right direction. The reason I am asking this question is because I implement a symbolic library and I need some sensible (and preferably non-trivial) defaults to gcd
and lcm
algorithms when the ring is the finite field $\mathbb{Z}_p$.
Any suggestions / ideas?