Number of solution pairs $(i,j)$ such that $i+jk \leq l$

60 Views Asked by At

I have show that the number of solutions $\left(\, i,j\,\right)$ of non-negative integers to $i + jk \leq l$ is $$ \left(\,\left\lfloor\, l \over k\,\right\rfloor +1\,\right) {2l + 2 - k\left\lfloor\, l/k\,\right\rfloor \over 2} $$

I thought of this as the solution to how many lattice points are in the triangle with points $(0,0), (l,0), \left(0, \left\lfloor\,\frac{l}{k}\,\right\rfloor\right)$.

If $h = gcd(l, \lfloor\frac{l}{k}\rfloor) -1$ then there are $l + \lfloor\frac{l}{k}\rfloor + 1 +h$ points on the boundary and $\frac{(l-1)(\lfloor\frac{l}{k}\rfloor -1) -h}{2}$ interior points of the triangle and the solution would be two just add these two together.

Doing that however didn't result in what I was supposed to show, so if somebody could point out where I've gone wrong here I'd appreciate it!

1

There are 1 best solutions below

0
On

The triangle you want consists of all points in the first coordinate below the line $x+ky \leq l$, so you want the vertices to be $(0,0)$, $(l,0)$, and $(0, \frac{l}{k})$.

You could try to get from your answer to the correct solution by counting all lattice points in the triangle with vertices $\left(0, \left\lfloor\,\frac{l}{k}\,\right\rfloor\right), (0,\frac{l}{k}), (l,0)$, besides the $h+1$ points you've already counted on the line from $\left(0, \left\lfloor\,\frac{l}{k}\,\right\rfloor\right)$ to $(l,0)$, and add those to your total.

I'm not sure if there's an easy way to do that or not. Presumably that piece would include a $-h/2$ term.

By writing $l = mk + a$, for some $a$ with $0 \leq a < k$, I was able to verify algebraically that $$ \sum_{i=0}^{l} \left(\left\lfloor\,\frac{i}{k}\,\right\rfloor+1\right) = \left(\,\left\lfloor\, l \over k\,\right\rfloor +1\,\right) {2l + 2 - k\left\lfloor\, l/k\,\right\rfloor \over 2}, $$ so if your geometrical method doesn't yield fruit, you could try that approach.