# Integer values of this expression

Is there a simple way to find the integer values of f(x)=(a+5x)/(6x+1) with a, x integers.

CompuChip
Homework Helper
If you pick any integer for x, you can set
$$a = (6x + 1) n - 5x$$
to get any integer n you like.

Is that what you meant by "finding the integer values"?

If you pick any integer for x, you can set
$$a = (6x + 1) n - 5x$$
to get any integer n you like.

Is that what you meant by "finding the integer values"?

In fact, it's exactly the opposite I want. a is a given integer and I am looking for the value(s) of x that make f(x) take integer values. It's simple enough for small values of a but for large values, I cannot afford to check the values of x one by one.

One thing that may help, other than the obvious observation that x=0 and x=a-1 are always solutions, is that solutions (like these trivial two) come in pairs: that is, if $x_0$ is a solution, producing an integer $n_0 = \frac {5x_0 + a} {6x_0 + 1}$, then it's not hard to prove that $x_1=n_0 - 1$ is a solution too (which will produce the integer $n_1=x_0+1$).

At least this cuts the search up to something on the order of the sqrt(a): now you need to iterate, from k=1 to a maximum of k=$\lfloor \frac {2 + \sqrt{4+6a}} 6 \rfloor$, checking if $a \equiv k+1 \pmod {6k+1}$, in which case both x=k and x=$\left( \frac {5k+a} {6k+1} - 1 \right)$ are two new solutions (or one, if these two "dual" solutions happen to be the same).

CompuChip