# Number of numbers divisible by 5 and 6

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.

-
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

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

-
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! –  Ali Amiri 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.

-

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.

-