1 | initial version |

You can do it like this:

```
sage: R.<x> = PolynomialRing(ZZ)
sage: n = 3
sage: f = x^3 + 1
sage: all(n.divides(c) for c in f.coefficients())
False
sage: g = 3*f
sage: all(n.divides(c) for c in g.coefficients())
True
```

The same approach also works for multivariate polynomials:

```
sage: R.<x,y> = PolynomialRing(ZZ)
sage: n = 3
sage: f = x^3 + y^3
sage: all(n.divides(c) for c in f.coefficients())
False
sage: g = 3*f
sage: all(n.divides(c) for c in g.coefficients())
True
```

Instead of `n.divides(c)`

(assuming `n`

is a SageMath `Integer`

, as it is above) you could also use `c % n == 0`

.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.