Ask Your Question

Revision history [back]

One option is to work with polynomials, say with integer coefficients:

sage: S.<a,b> = ZZ[]
sage: f = (8223*b+6341)*(8221*a+6339)

Now reduce f mod 67586227:

sage: R = IntegerModRing(67586227)
sage: f
67601283*a*b + 52129361*a + 52125597*b + 40195599
sage: f.change_ring(R)
15056*a*b + 52129361*a + 52125597*b + 40195599