Multiples of six in an interval

3.6k Views Asked by At

How many multiples of $6$ are there between the following pairs of numbers?
$0$ and $100$ and $-6$ and $34$.

  1. $16$ and $6$
  2. $17$ and $6$
  3. $17$ and $7$
  4. $16$ and $7$

My attempt:

Total number of integer between $0$ to $100 = 101$ So, total number of multiplier between $0$ to $100 = \left\lfloor\frac{101}{6}\right\rfloor = 16$

And, Total number of integer between $-6$ to $34 = 41$ So, total number of multiplier between $-6$ to $34 = \left\lfloor\frac{34}{6}\right\rfloor = 6$

But, somewhere it explained as:

Number of multiples of $6$ between $1$ and $100 = 100/6 = 16$ Since the range starts from zero, we need to take zero too. [zero is a multiple of every integer (except zero itself)]. So, answer $= 16+1 = 17$ Number of multiples of $6$ between $1$ and $34 = 34/6 = 5$ Since the range is $-6$ to $34$, we need to take $-6$ and zero.

So, answer $= 5+2 = 7$.


However, this small question and we can count on fingers.

But, what is wrong with my approach, can you explain it, please?

3

There are 3 best solutions below

0
On BEST ANSWER

Probably the best way to adapt your approach for accuracy is to find the first multiple of $6$ (or in general $d$) in the range. Then adjust the interval if necessary (and it's not necessary in your case), and apply your calculation to just the difference of the adjusted start to the end, to give the additional multiples of $d$ in range.

So given an interval $[s,f]$ how many multiples of $d$? $$\begin{align}s &\to s' \qquad s'\text{ is first multiple of $d$ in range}\\ \text{Multiples: }m &= 1+ \left\lfloor\frac{f-s'}{d}\right\rfloor \end{align}$$

0
On

Factor: A factor of an integer n is any number that divides n without remainder and $0$ is a factor of any integer except $0$. A factor of a number $n$, we get another of $n$.

Here, I add only one number(i.e, $0$), which should be after an interval of $6$. So, the answer should be $17$ and $7$.

1
On

There are no multiples of $m$ bewteen $km+1$ and $km + (m-1)$ and the only multiple between $km$ and $km + (m-1)$ is $km$.

So....

The multiples of $m$ between $km + 1$ and $jm$ will be the $lm$ for $k < l \le j$ or $0 < l-j \le j-k$ and there will be $j-k$ of them.

The multiples of $m$ between $km$ and $jm$ will be the $lm$ for $k \le l \le j$ or $0 \le l-j \le j-k$ and there will be $(j-k) + 1$.

The multiples of $m$ between $km + i;0\le i < m$ and $jm + n; n\le 0 < m$ will be $j-k$ if $i > 0$ and $(j-k)+1$ if $i= 0$.

So....

Between:

$0=6*0$ and $100=96+4$ will have $\frac {96}6 + 1$.

$−6=-6$ and $34=30+4$ will be $\frac {30-(-6)}6 + 1$.

$16= 12 + 4$ and $6$ will be $\frac{12-6}{6}+1$

$ 6= 6$ and $17=12+5$ will be $\frac{12-6}{6} + 1$

Those all had the lower term itself being a multiple of $6$.

$7 = 6+1$ and $17= 12 + 5$ will be $\frac{12-6}{6}$. This was the only one were the lowest term was not itself a multiple of $6$.