1
$\begingroup$

For given rational numbers $p_1/q_1,p_2/q_2,p_3/q_3$ and a negative integer $d$, I'd like to find quadruples of integers $(w,x,y,z)$ in a rectangle(of particular sidelengths) satisfying the series of inequalities of the form $1+w+di+\left[\frac{ip_1+x}{q_1}\right]+\left[\frac{ip_2+y}{q_2}\right]+\left[\frac{ip_3+z}{q_3}\right]\leq 0$ (for $1\leq i\leq \mathrm{lcm}(q_1,q_2,q_3)$). The following is the code that I tried:

Solve[ForAll[i, 
   i \[Element] Integers && 
    1 <= i <= LCM[Denominator[a], Denominator[b], Denominator[c]], 
   1 + w + i*n + Floor[(i*Numerator[a] + x)/Denominator[a]] + 
     Floor[(i*Numerator[b] + y)/Denominator[b]] + 
     Floor[(i*Numerator[c] + z)/Denominator[c]] <= 0] && 
  0 <= w <= Floor[2 - n - a - b - c] && 0 <= x < Denominator[a] && 
  0 <= y < Denominator[b] && 0 <= z < Denominator[c], {w, x, y, 
  z}, Integers]

And it shows the message that this system cannot be solved with the methods available to Solve even for a small input like $(1/2,2/3,4/5,-2)$. The same happens for other functions with similar roles, like Reduce or FindInstance.

As I'm doing finite search, I suppose there must be a way to make this code work properly in Mathematica. Can someone suggest the correct way to do this?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.