commands → remainder

remainder(A,B)
remainder(A,B,X)
remainder(A,B,X,P)

The remainder command computes the remainder of A divided by B where A and B can be integers or polynomials. In the polynomial case, the variable X must be specified as the third argument and an optional fourth argument P specifies the modulus.

Examples

# integers
remainder(25,10);
	5

# polynomials
remainder(x^2+x+1,x+1,x);
	1

# polynomials mod p
remainder(x^2+x+1,x+1,x,11);
	1

References

Gullberg, Jan. Mathematics: From the Birth of Numbers. Norton, 1996.