> < ^ Date: Wed, 06 Jul 1994 09:43:00 +0200
> < ^ From: Joachim Neubueser <joachim.neubueser@math.rwth-aachen.de >
> < ^ Subject: Re: GF(2)_polynomials

Chris Charnes writes:

I would like a routine that does the following: f, g are polynomials
over GF(2), deg(f) >> deg(g), I require the remainder when g divides
f; i.e. f=h*g + r, where deg(r) < deg(g). (The Euc. Algorithm).

There is in fact a GAP function 'EucledianRemainder' in the manual
which does exactly what you require:

```gap> p := Z(2)^0*(X(GF(2))^4 + X(GF(2))^2 + X(GF(2)) + 1);;
gap> q := Z(2)^0*(X(GF(2))^2 + 1);;
gap> EuclideanRemainder( PolynomialRing( GF( 2 ) ), p, q );
Z(2)^0*(X(GF(2)) + 1)
```

If you find the input of polynomials of high degree over GF(2) too
clumsy in this form there is a trick to save some writing:

```gap> p := Polynomial( GF( 2 ), [ 1, 1, 1, 0, 1 ] * GF( 2 ).one );
Z(2)^0*(X(GF(2))^4 + X(GF(2))^2 + X(GF(2)) + 1)
gap> q := Polynomial( GF( 2 ), [ 1, 0, 1, ] * GF( 2 ).one );
Z(2)^0*(X(GF(2))^2 + 1)
gap> EuclideanRemainder( PolynomialRing( GF( 2 ) ), p, q );
Z(2)^0*(X(GF(2)) + 1)
```

Please excuse me however for suggesting first to look up the manual
before writing to 260 members of the GAP forum. Even though the manual
is long it has an index which in this case gives:

EuclideanRemainder
. . .
for polynomials 392

```Polynomials          383

Field
. . .
finite             375
```
```Kind regards,            Joachim Neubueser
```

> < [top]