Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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: enter image description here

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$.

share|cite|improve this question
You haven't told us what $n_1,n_2,\dots,n_k$ are, nor what $k$ is. – Gerry Myerson Jan 17 '13 at 22:41
Sorry about that; I've edited the question accordingly. – Babiker Jan 17 '13 at 23:15
Still not clear. When you write $n=7$, do you mean $a=7$? More importantly, is my answer relevant, or have I missed the point? – Gerry Myerson Jan 17 '13 at 23:42
You're right, I meant $a=7$. And yes, your answer is relevant. – Babiker Jan 17 '13 at 23:51
up vote 1 down vote accepted

The question is not clear.

If $a$ and $b$ are not relatively prime, you will never have $bn_k=an\pm1$. I don't understand the phrase, "under a given number".

So, let's assume $a$ and $b$ are relatively prime.

Then the equation $ax-by=1$ has exactly one solution in integers $x$ and $y$ with $1\le x\le b$ and $1\le y\le a$. More generally, it has exactly $Q$ solutions with $1\le x\le Qb$ and $1\le y\le Qa$. Note that $ax-by=1$ is $by=ax-1$ which is just $bn_k=an-1$ with different letters.

Similar formulas apply to $bn_k=an+1$, treating it as $bx-ay=1$.

If I have seriously misunderstood the question, please edit the question to clarify.

share|cite|improve this answer
Hello there, can you help me out here? I constructed a complete model of the markov chain taxi cab problem with the two zones and then the question got deleted before I could post. What to do? – Marko Riedel Jan 18 '13 at 0:51
@Marko, what do you want to do? OP got what was needed, and deleted the post. You could send email to the moderator team, I suppose, and tell them it was question 280938. Or you could start a thread on meta, explaining why you'd like people to vote to undelete. – Gerry Myerson Jan 18 '13 at 2:20
Well I don't know if its worth all that trouble, it is too bad that we cannot put a temporary advisory lock on a question so one gets a warning when it is about to be deleted and can then take it to the comments section. I can however say in all honesty that I do not know whether my answer, which uses generating functions is (a) correct and cannot (b) be done more easily with Markov chains. So I could write an intro and re-post it as a question. However I do have a fear of being flamed as a spammer, so please advise me whether this would be acceptable. Then upvote/downvote after that. – Marko Riedel Jan 18 '13 at 2:31
@Marko, genuine mathematical questions are never considered spam. If you have a way to do a problem, and you want to know whether it is correct and/or whether it's as good as some other way to do the problem, I can't think of a better way to find out than to post it as a new question at this website. – Gerry Myerson Jan 18 '13 at 2:47
That's very kind. I think I'll give it another try. – Marko Riedel Jan 18 '13 at 2:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.