Matthias is hinting at a possible reformulation of the problem as finding integral points in a polyhedron. Let me expand.
In RR^2, consider the set S of all (x, y) satisfying: x >= 1 x <= 9 y >= 1 y <= 9 x + y = 15 or if one prefers, -1 + x >= 0 9 - x >= 0 -1 + y >= 0 9 - y >= 0 -15 + x + y = 0 Since all the conditions used to define this set are of one of the following forms: (linear form in x and y) = 0 (linear form in x and y) >= 0 the subset S is what is called a "polyhedron" in R^2. The problem in your original post can now be rephrased as: Find all integral points in the polyhedron S. An introduction to polyhedra in Sage is at: http://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedron/constructor.html The polyhedron S can be input as S = Polyhedron(ieqs=[[-1, 1, 0], [9, -1, 0], [-1, 0, 1], [9, 0, -1]], eqns=[[-15, 1, 1]]), Check that our input represents the correct polyhedron: sage: print(S.Hrepresentation_str()) x0 + x1 == 15 -x0 >= -9 x0 >= 6 Find all integral points: sage: S.integral_points() ((6, 9), (7, 8), (8, 7), (9, 6)) -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/3e9f5212-645d-40ce-bbd1-7549e2bf1f21%40googlegroups.com.