Finding overlapping terms of two finite arithmetic sequences Consider the two arithmetic sequences:
$3,7,11,\ldots,603$
$2,9,16,\ldots,709$
How many terms are common to both?
Clearly the $n$th term of the first sequence is $a_n=4n-1$ and $b_n=7n-5$ for the second, but I am lost as to how to compute the total number of terms that overlap. Any ideas?
 A: In order for it to be the case that for certain integers $m,\,n$
$$ a_m=4m-1=7n-5=b_n\tag{1}$$
it must be true that
\begin{equation}7n-4m=4
\end{equation}
Thus it must be the case that  $n=4k$ for some integer $k$.
So only elements $b_n=b_{4k} =28k-5$ of the $b_n$ sequence will occur in the $a_m$ sequence and it must be the case that $28k-5\le603$. Thus $1\le k\le21.$
So the $21$ numbers $23,51,79,\cdots,583$ will occur in both sequences.
But are these the only terms in common?
Putting $n=4k$ into equation $(1)$ we find that
\begin{eqnarray}
28k-4m&=&4\\
7k&=&m+1
\end{eqnarray}
So $m+1$ must be a multiple of $7$. So we re-write the equation for $a_m$ as
\begin{eqnarray}
a_m&=&4m-1\\
&=&4(m+1)-5\\
&=&28k-5
\end{eqnarray}
Thus the $21$ numbers of the form $28k-5$ are the only numbers the two sequences have in common.
In general we have $a_{7k-1}=b_{4k}$ for $1\le k\le21$.
A: Simply check when $a_n $ can be equal to $b_n $. Beware, though, that they may overlap without it being in the same position. That is, do not check $4n - 1= 7n - 5$ ,check instead
$$a_n = b_k \iff 4n - 1 = 7k - 5$$
That should not be too difficult given that $n $ and $k $ must be integers.
We show it can be done:
$$4n - 1 = 7k - 5 \iff\\
4n + 4 = 7k \iff\\
4(n+1) = 7k \iff\\
4j = 7k$$
Dividing left side by seven and right side by four, we get $\frac{4j}{7} = k$ and $j = \frac{7k}{4}$ from which we conclude that $j$ is a multiple of $7$ and $k$ is a multiple of $4$. Let us write $k = 4i$ and substitute:
$$4j = 7(4i) \iff\\
j = 7i$$
Thus if we pick some integer value for $i$, we then get $j = 7i, k = 4i, n = j-1$. All you have to do now is check the ranges for legal values of $i$.
Some common terms would be:


*

*$i = 1, j = 7, k = 4, n = 6: a_n = 23; b_k = 23$

*$i = 200, j = 1400, k = 800, n = 1399: a_n = 5595; b_k = 5595$
So clearly $i$ can't go all the way up to $200$. Can you tell what is its maximum value?
