If I let $a, b$, and $n$ be integers greater than $0$ and I incrementally and consecutively plot $a{n}-1$ and $a{n}+1$ on a number-line such that when $a=2$ , I plot points { $2n_1-1, 2n_1+1$, $2n_2-1, 2n_2+1$, ... , $2n_k-1,2n_k+1$ } and when $a=3$, I plot { $3n_1-1, 3n_1+1$, $3n_2-1, 3n_2+1$, ... , $3n_k-1, 3n_k+1$ }, possibly omitting duplicate points. Then I plot $bn$ along the same number-line as in { $bn_1, bn_2,...,bn_k$}. How do I count all the instances where any $bn_k$ is also equal to any $an-1$ or $an+1$ under a given number? Lastly, please excuse any informal use of notation resulting from my lack of knowledge in the topic and feel free to edit.
Clarification:You can ignore the confusing upper part of this question. I will be keeping it until the one answer I've gotten so far gets edited.
Consider the following graphic:

The points on the upper line are $12$ apart while the ones on the lower line are $5$ apart. The points on the upper line progress by $12n$ where each point's $n$ value is 1 more then the $n$ value of the previous point as in $\{12\ast1, 12\ast2, 12\ast3, ..., 12\ast k\}$. This mechanism applies to the lower line where the constant is $5$. Now, notice the two read points on the lower line which are $5\ast5$ and $5*7$, these points can be expressed as $12n+1$ and $12n+1$. My question is, given any length of plot how do i calculate the number of points that can be expressed either as $xn-1$ or $xn+1$. The two red points on the $5$ line can be expressed as $12n-1$ and $12n+1$ and the two black points on the twelve line next to the red points can be expressed as $5n-1$ and $5n+1$.