Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given parameters $a,b,D$, all integers, I want to find all the integer solutions $(x,y)$ of

$ax+by\le D$

Or at least a nice way to characterize them. Also, for a given $R$, it is actually enough for me to find the solutions which also satisfy

$x^2+y^2\le R^2$

(i.e. all the integer points in a some disc around the origin) but if the problem can be solved without using this additional constraint I'd be happy to hear how.

share|cite|improve this question

1 Answer 1

up vote 1 down vote accepted

Let's suppose $a > 0$ (you can do the other cases yourself). Then $a x + b y \le D$ means $x \le (D - b y)/a$. So for any integer $y$, $x$ is any integer $\le \lfloor (D - b y)/a \rfloor$.

share|cite|improve this answer
Of course, how silly of me. – Gadi A Nov 12 '12 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.