Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage doesn't work that way, e.g. k0 in ZZ and j in ZZ evaluate to False because they are symbolic variables. You meant assume(k0, 'integer') and assume(j, 'integer'). Still, solve doesn't seem very good at your problem. Instead, you can define your solution set as a Polyhedron and ask for its integral points:

sage: p = 5
sage: j = 1
sage: Polyhedron(ieqs=[[0,1,0], [p-2,-1,0]], eqns=[[-k, 1,p-1]]).integral_points()
((1, 0),)
click to hide/show revision 2
No.2 Revision

Sage doesn't work that way, e.g. k0 in ZZ and j in ZZ evaluate to False because they are symbolic variables. You meant assume(k0, 'integer') and assume(j, 'integer'). Still, solve doesn't seem very good at your problem. Instead, you can define your solution set as a Polyhedron and ask for its integral points:

sage: p = 5
sage: j k = 1
sage: Polyhedron(ieqs=[[0,1,0], [p-2,-1,0]], eqns=[[-k, 1,p-1]]).integral_points()
((1, 0),)