Integer Euclidean quotient

### 6.1.8 Integer Euclidean quotient

The quotient and remainder of ordinary integers a and b are respectively integers q and r, where a=b q+r and 0 ≤ r < b.

The quotient and remainder of Gaussian integers a and b are respectively Gaussian integers q and r where r=a−b q is as small as possible. It can be proven that r can be found so that |r|2 ≤ |b|2/2.

The iquo or intDiv command finds the integer quotient of two integers.

- iquo takes two arguments: a and b, integers.
- iquo(a,b) returns the quotient q of a and b.

The div operator is the infixed version of iquo.

#### Examples

iquo(148,5)

29 |  |  |  |  |  |  |  |  |  |

iquo(factorial(148),factorial(145)+2)

3176375 |  |  |  |  |  |  |  |  |  |

iquo(25+12*i,5+7*i)

3−2 i |  |  |  |  |  |  |  |  |  |

Here r=a−b q=−4+i and |−4+i|2=17<|5+7 i|2/2=74/2=37.

148 div 5

29 |  |  |  |  |  |  |  |  |  |