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

How can I count the number of numbers divisible by both 5 and 6?

For example let's take only tree-digit numbers, how many of them are divisible by both 5 and 6?

I know how to do it just for 5 or just for 6, using the arithmetic sequence

an = a1 + (n-1)*d

So for just for 5:

995 = 100 + (n-1)*5
n = 180

And just for 6:

996 = 102 + (n-1)*6
n = 150

But how can I count the numbers divisible by both 5 and 6? I know that the answer is 30, but I don't know how to calculate it.

share|cite|improve this question
So I assume you can do it for 2 and 3, since these are also simple cases. And you also know how to do it for 6. Can you see how to apply that knowledge to the question you have asked. – Mark Bennet Apr 12 '12 at 9:55
$5|x$ and $6|x$ if and only if $30|x$ (and someone correct me if I'm wrong...) – Belgi Apr 12 '12 at 9:59
up vote 4 down vote accepted

If $n$ is divisible by 5 and by 6, then it is divisible by 30, and conversely; so just apply your method with $d = 30$ and you're done.

(A much more challenging, and fun, question is to count three-digit numbers divisible by 5 or 6.)

share|cite|improve this answer
Thanks how simple :-) Why shouldn't I try it :D Btw: if you know 5 and 6 then 5 or 6 is simple .. 180+150-30=300 – user1097772 Apr 12 '12 at 10:13
This answer could be a comment! – Lrrr Apr 12 '12 at 10:45

If n is divisible by m1 and by m1, then it is divisible by LCM of m1 and m2. you can apply your method with d= LCM of 5 and 6 =30.

share|cite|improve this answer

Hint $\:$ Note $\rm\ \ \ 5,\:\!6\ |\ n\ \Rightarrow\ 30\ |\ n\ \ \ since\ \ \displaystyle \frac{n}{5},\; \frac{n}{6}\in\mathbb{Z} \;\;\Rightarrow\;\; \frac{n}{5} - \frac{n}{6} \; = \;\frac{n}{30} \in \mathbb Z$

Or: $\rm \ \ a,\:\!a\!+\!1\ |\ n\ \Rightarrow\ a(a\!+\!1)\ |\ n\ \ \ by\ \ \displaystyle \frac{n}{a},\; \frac{n}{a\!+\!1}\in\mathbb{Z} \;\;\Rightarrow\;\; \frac{n}{a} - \frac{n}{a\!+\!1} \; = \;\frac{n}{a(a\!+\!1)} \in \mathbb Z$

Generally $\rm\ a,b\ |\ n\iff lcm(a,b)\ |\ n.\:$ See this post for much more on related matters.

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.