1 | initial version |

Polynomial rings have monomial orderings (in this case it is degrevlex by default), and the terms of polynomials are automatically ordered from greatest to smallest (with respect to the monomial ordering), as you can see e.g. with `print(f)`

.

You can get the exponents you want like this:

```
sage: [e for e in f.exponents() if all(e_i % 5 == 0 for e_i in e)]
[(10, 5, 0)]
```

Or the indices of the respective terms (again, with respect to the monomial ordering):

```
sage: idc = [k for (k,e) in enumerate(f.exponents()) if all(e_i % 5 == 0 for e_i in e)]; idc
[0]
```

Or the terms themselves:

```
sage: sum(prod(t) for (k,t) in enumerate(list(f)) if k in idc)
x^10*y^5
```

A bit more efficiently:

```
sage: terms = list(f)
sage: sum(prod(terms[k]) for k in idc)
x^10*y^5
```

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.