For the function $$f(x) = (a/b)x + (c/b)$$
how do I find the smallest value x such that:
$$\lceil f(x)\rceil < \lceil f(x) + kx\rceil $$
where x is a positive integer, a, b, and c are integers, c/b < 1, and k is a positive rational less than 1?
Written another way: $$\lceil f(x)\rceil + 1 = \lceil f(x) + kx\rceil $$ or $$\lceil (a/b)x + (c/b)\rceil + 1 = \lceil (a/b)x + (c/b) + kx\rceil$$
If you have a solution, or if you're just in a hurry, you might want to skip the rest of this. The reason I'm asking is because I want to find the summation of all the values within a given range of the ceiling of f(x). My solution was to brute force the answer from 0 to b (count them one at a time), then calculate the rest because after b it repeats geometrically. But this doesn't work when b is very large, because then I end up brute forcing the entire thing.
My current plan is to approximate the slope with a smaller denominator so I can do the above solution for a portion of the range. For instance: $$f(x) = (172592/179897)x + (108554/179897)$$ 179897 is too large to brute force. An approximation is: $$ g(x) = (189/197)x + 108554/179897$$ The slopes are off by a difference of k, which is roughly 0.000002.
Thus, the difference between f(x) and g(x) is k: $$f(x) = g(x) + kx$$ They have the same ceiling function until the point where f(x) is within kx of the next integer.
Update: I just realized my function can be simplified. In the problem statement, the lines come from vertices of a triangle at integer coordinates, so the denominator of the slope and the denominator of the intercept are the same, since both are x1-x2. I'll fix the question above.