Quotient and Remainder algorithm for Euclidean's

141 Views Asked by At

I've done the Euclidean algorithm before, but I'm trying to come up with separate algorithms for the quotient and remainder part that I can implement in some pseudo-code.

Ex: I have two polynomials '$a$' and '$b$' in (for simplicity's sake) $GF(2)[x]$. Then I have two other polynomials '$q$' and '$r$' (quotient and remainder) such that $a=bq+r$.

What I want to do is come up with two algorithms: $Quot(a, b)$ and $Rem(a, b)$ which compute '$q$' and '$r$'.

The Euclidean algorithm itself isn't hard to implement. A simple implementation is:

def gcd(a, b):
     while b:
      a,b = b, a % b
    return a

Then solve backwards using r* = qr + (new r)

Just having trouble figuring this out. It seems like something very simple that I'm not getting.