Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

For what $1\leq r\leq a$ does $\gcd(a,r)\mid b$?

I am looking for an easy way to calculate these $r$ for any given $a$ and $b$.

share|cite|improve this question
What is $b$ here? – Álvaro Lozano-Robledo Mar 23 '13 at 19:56
Any given integer – Ethan Mar 23 '13 at 19:58
Does $b|\gcd(a,r)$ or $\gcd(a,r)|b$? – Álvaro Lozano-Robledo Mar 23 '13 at 19:58
@ÁlvaroLozano-Robledo $\gcd(a,r)\mid b$ , sorry I fixed it – Ethan Mar 23 '13 at 20:00
up vote 3 down vote accepted

If $(a,r)\mid b$ then, since $(a,r)\mid a$ automatically, the stronger claim $(a,r)\mid(a,b)$ is also satisfied, and the converse holds as well since $(a,b)\mid b$. That is, $(a,r)\mid b\iff (a,r)\mid(a,b)$.

The $1\le r\le a$ for which $(a,r)\mid(a,b)$ are $\{dc:~d\mid(a,b),~1\le c\le a/d,~(c,a)=1\} $.

share|cite|improve this answer

Hint $\rm\ \ (a,r)\mid b \iff (a,r)\mid a,b \iff (a,r)\mid (a,b)$

share|cite|improve this answer


Case 1:




If you have $\gcd(a,r) | b \implies \gcd(a,r)=1$

For the other case, take $\gcd (a,b)=k$ and see how it works.

Then $a=nk$, and $b=mk$ (Where again $\gcd (m,n)=1$)

If $\gcd (a,r) |b \implies \gcd(a,r)=k$

The conditions for $r$ is $\gcd (a,r) =\gcd(a,b)$

share|cite|improve this answer

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.