I was working a problem to find if two AP meet or not and came across the below post Formula to find if two AP meet
and in that the formula given by user is
$$A_n=A_1+(n−1)d$$
$$B_m=B_1+(m−1)D$$
and if $A_n=B_m$ then they meet. But somehow it failed for my case of $A_1=14,d=4 B_1=98,D=2$. Could you please tell me where i went wrong or the formula was wrong?
The $2$ sequences meet, but with $n$ being $22$, not $2$, for $m$ being $1$, with them meeting at $98$, as can be easily confirmed by plugging the values into the equations: $$14 + \left(22 - 1\right)4 = 14 + \left(21\right)4 = 14 + 84 = 98$$ $$98 + \left(1 - 1\right)2 = 98 + 0 = 98$$ Note to determine $n$ and $m$, subtracting the second general formula from the first general one provided in the question gives: $$84 = \left(n - 1\right)4 - \left(m - 1\right)2$$ $$84 = 4n - 4 - 2m + 2$$ $$86 = 4n - 2m$$ $$43 = 2n - m$$ Since both $m$ and $n$ must be $\geq 1$, so this limits what there values can be. As $43$ is odd and $2n$ is even, the values of $m$ must all be odd. The smallest odd value is $1$, with this giving $2n = 43 + 1 = 44$, so $n = 22$.
For each increase in $n$, the right side increases by $2$, so $m$ must increase by $2$ (as it is being subtracted) to compensate to keep it an equation. Thus, the sets of $\left(n,m\right)$ values which work are $\left(22,1\right),\left(23,3\right),\left(24,5\right),\ldots$, i..e, in general being $(22 + a, 1 + 2a)$ for $a$ being non-negative integers. This keeps going up for $a = 16$ giving $\left(38,33\right)$, resulting in $162$ as stated by the question's author, hardyz009, in his/her comment to the original question.