Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Finding a unique integer solution to a set of inequalities

I am trying to find the unique integer solution to a set of equalities and inequalities. The equations I have are 0<=k0<p-1 and k=k0+j(p-1). I know that for p a prime >=5 and k an integer, there is is a unique set of integers k0 and j such that these equations are satisfied. However, I can't seem to implement this.

What I have is

k0,j = var('k0 j')
solve([0<=k0<p-1,k==k0+j(p-1),k0 in ZZ,j in ZZ],k0,j)

Where I added the "in ZZ" parts later to try and force it to give me an answer, but no matter what I plug in for p and k, the output is always just

(k0, j)

What exactly am I doing wrong?