Previous Up Next

7.1.9  Integer Euclidean remainder

The irem or remain command finds the remainder of two integers (see Section 7.1.8).

Examples

irem(148,5)
     
3           
irem(factorial(148),factorial(45)+2)
     
111615339728229933018338917803008301992120942047239639312           
irem(25+12*i,5+7*i)
     
−4+i           

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

The smod or mods command finds the symmetric remainder of two (ordinary) integers.

Example

smod(148,5)
     
−2           

The mod or % operator is an infixed operator which takes an integer to a modular integer.

Example

148 mod 5

or:

148 % 5
     

−2
%5
          

Note that the result -2 % 5 is not an integer (−2) but an element of Z/5Z (see Section 11.8 for the possible operations in Z/5Z).


Previous Up Next