I have an equation of the form $A*i*j + B*i +C*j = N$ where I have the values of $A,B,C$ and $N$ and I want to solve for integer values of $i$ and $j$.
How would I approach this? I could try trial and error but the numbers I'm working with are relatively large (eg $>10^{40}$). But I'm also happy to work on understanding the process with much smaller numbers. I'm not sure if it matters, but it's also possible there will not be a solution.
Multiply the whole equation by $A$.
\begin{align} A^2ij+ABi+ACj&=AN\\ (Ai+C)(Aj+B)&=AN+BC \end{align}
So $Ai+C$ and $Aj+B$ are factors of $AN+BC$.
For example, consider $2ij+3i+7j=336$. the equation can be written as
\begin{align} 2ij+3i+7j&=336\\ 4ij+6i+14j&=672\\ (2i+7)(2j+3)&=693 \end{align}
$693=3^2\cdot7\cdot11$.
Factors of $693$ has the form $\pm3^a\cdot 7^b\cdot 11^c$, where $a\in\{0,1,2\}$ and $b,c\in\{0,1\}$. The numner of possible factors is $2\times3\times2\times2=24$.
S0, all possible $2i+7$ are $\pm1$, $\pm 3$, $\pm9$, $\pm7$, $\pm 21$, $\pm63$, $\pm 11$, $\pm 33$, $\pm 99$, $\pm77$, $\pm231$ and $\pm693$.
All possible $(i,j)$ are $(-3,345)$, $(-2,114)$, $(1,37)$, $(0,48)$, $(7,15)$, $(28,4)$, $(2,30)$, $(13,9)$, $(46,2)$, $(35,3)$, $(112,0)$, $(343,-1)$, $(-4,-348)$, $(-5,-117)$, $(-8,-40)$, $(-7,-51)$, $(-14,-18)$, $(-35,-7)$, $(-9,-33)$, $(-20,-12)$, $(-53,-5)$, $(-42,-6)$, $(-119,-3)$, $(-350,-2)$ .