<s>[INST] How can I find a number $n$ such that $(c + d \times n)$ is a multiple of $(a + n)$? As an example, let $a=5$, $c=246$, and $d=316$.  My goal is to find a positive integer $n$ such that
$$(a + n) | (c + d \times n)$$
$$(5 + n) | (246 + 316 \times n)$$
I know that one solution is $18$, since
$$(5 + 18) | (246 + 316 \times 18)$$
$$23 | 5934$$
$$23 \times 258 = 5934$$
The number $24$ is also a solution, as well as a few other numbers.
How can I find solutions to this problem directly?  So far, the only way that I have found solutions is through brute force (try every possible number in order), but that is horribly inefficient.
Also, if I were to change the restriction from "being a multiple" to "having a GCF $> 1$" would it make the problem any easier?
 [/INST] Make the ansatz
$$d\cdot n + c = (d+k)\cdot(n+a).$$
Expanding the right hand side, you get
$$\begin{align}
d\cdot n + c &= d\cdot n + k\cdot n + d\cdot a + k\cdot a\\
c - d\cdot a &= k\cdot (n+a).
\end{align}$$
So you need to factorise $\lvert c - d\cdot a\rvert$ (if that is $\neq 0$, if $c = d\cdot a$, then all $n$ work), and can then check which factorisations yield a suitable $n$ (the second factor must be $> a$).
In your example, you have $d\cdot a - c = 5\cdot 316 - 246 = 1334 = 2\cdot 23\cdot 29$.
That yields the factorisations
$$\begin{align}
c - d\cdot a &= -1\cdot 1334 \leadsto n = 1334-5 = 1329\\
&= -2\cdot 667 \leadsto n = 667-5 = 662\\
&= -23\cdot 58 \leadsto n = 58-5 = 53\\
&= -29\cdot 46 \leadsto n = 46-5 = 41\\
&= -46\cdot 29 \leadsto n = 29-5 = 24\\
&= -58\cdot 23 \leadsto n = 23-5 = 18\\
&= -667 \cdot 2 \leadsto n = 2-5 = -3 < 0\quad\text{ invalid}\\
&= -1334 \cdot 1 \leadsto n = 1-5 = -4 < 0\quad\text{ invalid}.
\end{align}$$
</s>