0

Given all of the three-digit numbers: 100, 101, 102, 103......999.

A. out of these numbers, find out how many numbers can be divided by 3 without remainder. B. out of these numbers, find out how many numbers can not be divided by 3.

A is easy:

$$999 = 100 + (n - 1)d => 999 -100+3 = 3n => 3n = 300$$

But how can I do the second one? I have no way actually...

Roy
  • 111
  • Can a number be both divisible by 3 and not? – doppz Nov 11 '13 at 15:34
  • @doppz Im not sure about your question, but isn't the answer is 999 - 300? but its 699, the answer is 600. – Roy Nov 11 '13 at 15:37
  • You're close, just a little off. How many numbers are between $100$ and $999$? – doppz Nov 11 '13 at 15:37
  • 899, but 899 - 300 = 599, very close. What did I miss? – Roy Nov 11 '13 at 15:39
  • Still a little off. There are 900 such numbers. There are 1000 from 0 to 999, but you throw away the first 100 from 0 to 99, of which there are 100. Hence, 900 in total. – doppz Nov 11 '13 at 15:40
  • I don't get why did 100 become 99, is that because of the n - 1? Doubt it cause n = position – Roy Nov 11 '13 at 15:41
  • No need to include $n$. Look at what I said again, you should be able to see it. You want to calculate 999-99, not 999-100, because you're including 100 in your interval. – doppz Nov 11 '13 at 15:43

2 Answers2

2

Your work has gone a bit astray in the first part. $102$ is the first of the numbers on the list that is divisible by $3$, $999$ is the last, and the common difference between consecutive numbers divisible by $3$ is $3$. Hence, if $n$ is how many such numbers there are on the list, we are looking at $$999=102+3\cdot(n-1),$$ which we can solve to get $n=300.$

Letting $m$ be how many numbers are on the list altogether, we can take a similar approach. Once again, we are in an arithmetic progression, with $100$ the first number, $999$ the last, and $1$ the common difference, so we have $$999=100+1\cdot(m-1),$$ which we can solve to get $m=900.$ (Another way to see this: $100$ is first, $101$ is second, $102$ is third, and in general, $100+k$ is the $(k+1)$th on the list, so $999=100+899$ is the $900$th on the list.) Since there are $900$ altogether, and $300$ of them are divisible by $3$, then how many are not divisible by $3$?

Cameron Buie
  • 102,994
0

I like Cameron Buie's answer, but let's generalize!

How many integers between $a$ and $b$ are divisible by $d$?

Let $\#S$ be the size of a set $S$, and let's only consider integer-type variables, then we want

$ \;\;\;\;\;\#\{n : n \in a .. b \text{ and $d$ divides } n \ \} \\ = \#\{n : a \leq n \leq b \text{ and $n$ multiple-of } d \ \} \;\;\;\; \text{, rewrite condition} \\ = \#\{d \times n : a \leq d \times n \leq b \text{ and $d \times n$ multiple-of } d \ \} \;\;\;\; \text{, dummy rename} \\ = \#\{d \times n : \frac{a}{d} \leq n \leq \frac{b}{d} \} \;\;\;\; \text{, arithmetic and second condition is true} \\ = \#\{d \times n : \lceil\frac{a}{d}\rceil \leq n \leq \lfloor\frac{b}{d}\rfloor \} \;\;\;\; \text{, inequalities ---see below$(\star)$} \\ = \lfloor\frac{b}{d}\rfloor - \lceil\frac{a}{d}\rceil - 1 \;\;\;\; \text{, integer intervals $p..q$ have $q-p+1$ elements} $

Neato! Now for your case $a,b,d := 100,999,3$ and so we have $\lfloor\frac{999}{3}\rfloor - \lceil\frac{100}{3}\rceil - 1 = 333-34+1=300$ numbers between 100 and 99 that are divisible by 3.

With a bit more effort we have a more general result :)


$(\star)$ If $n$ is an integer less than a real $x$ then it's also less than the floor of $x$; eg $n \leq 3.14$ iff $n \leq 3$ since $n$ is an integer. In-general, $$ \;\; \forall n \in \mathbb{Z},x \in \mathbb{R} :: n \leq \lfloor x \rfloor \equiv n \leq x \;\; $$

is the characterization of the floor function; similarly for the ceiling function. Enjoy!


The fact that $\#(p .. q) = q - p + 1$ can be proven by induction; where for integers $p,q$ we define $p .. q := \{ n \in \mathbb{Z} : p \leq n \leq q \}$, which I call ``$p$ upto $q$''.