20
$\begingroup$

I'm studying for the GRE, and my study book uses a rule that it never justifies for counting numbers in a sequence: "Add $1$ before you're done."

For example, how many multiples of $3$ are between $250$ and $350$? My study book says:

$$ 348 - 252 = 96 $$

$$ \dfrac{96}{3} = 32 $$

Now "add one before you're done":

$$ 32 + 1 = 33 $$

I follow the first few steps. Start and end with $252$ and $348$ because they are the first and last multiples of $3$ within the range, respectively. We divide by $3$ to count only the multiples of $3.$ But why add $1$?

$\endgroup$
  • 18
    $\begingroup$ Fenceposts. $\endgroup$ – porglezomp Sep 29 '15 at 3:54
  • $\begingroup$ @porglezomp, I can't believe I've never heard of that. A very straightforward analogy. $\endgroup$ – gwg Sep 29 '15 at 11:17
  • 3
    $\begingroup$ Counting from $0$ to $1$, we get $\{0,1\}$ which contains two numbers, even though $1-0=1$ $\endgroup$ – BlueRaja - Danny Pflughoeft Sep 29 '15 at 15:22
  • $\begingroup$ Of course, Dijkstra had opinions on the subject. $\endgroup$ – James Wood Sep 30 '15 at 10:59
  • $\begingroup$ Related question. $\endgroup$ – Michael Albanese Sep 30 '15 at 11:29
73
$\begingroup$

Arrgh. This apparently was written by someone who thinks that mathematics is merely arbitrary rules to be memorized rather than something to be understood.

It starts by finding the distance between two multiples of $3$, then divides that distance by $3.$ In doing this, you are not calculating multiples of $3$, you are calculating the number of gaps of size three between the multiples. But the multiples themselves are the "fenceposts" that create the gaps. And there has to be one more "fencepost" than gap, to form the ends. For example:

  • $0,3$. Distance = $3 - 0 = 3$, number of gaps = $3/3 = 1$, number of multiples = $2 = 1 + 1$.
  • $0,3,6$. Distance = $6 - 0 = 6$, number of gaps = $6/3 = 2$, number of multiples = $3 = 2 + 1$.
  • $3, 6, 9, 12$. Distance = $12 - 3 = 9$, number of gaps = $9/3 = 3$, number of multiples = $4 = 3 + 1$.
$\endgroup$
  • 26
    $\begingroup$ +1 for the first paragraph (not that there's anything wrong with the rest of the post). $\endgroup$ – anomaly Sep 29 '15 at 11:57
  • $\begingroup$ Never heard of this rule before. Great explanation. I assume that rule only works if both the start and end point of the range are multiples of 3? Does it also work for any other numbers? $\endgroup$ – Obsidian Phoenix Sep 29 '15 at 14:02
  • 4
    $\begingroup$ It does require that the start and end points are adjusted to exact multiples, the "discard the remainder" approach suggested by Jacob is not reliable. Consider: How many multiples of 7 are in the interval [6,8]? Now, how many in the interval [1,13]? Or [8,10]? $\endgroup$ – Ben Voigt Sep 29 '15 at 18:26
  • $\begingroup$ I should admit I had never heard it described as "fenceposts" before either (that I remember). I only used the term to tie into porglezomp's comment on the OP. $\endgroup$ – Paul Sinclair Sep 29 '15 at 22:12
10
$\begingroup$

There are just as many multiples of $3$ between $252$ and $348$ (inclusive) as there are between $0$ and $348-252$, that is, $0$ and $96$. Now what one does is a matter of taste.

The number between $0$ and $96$ is the same as the number from $3$ to $99$, which is the same as the number of integers between $1$ and $33$.

Or else there are $32$ between $3$ and $96$. But don't forget about $0$.

Or else there are just as many as there are integers from $0$ to $32$. Again, don't forget about $0$. There are $33$ of these.

Remark: I prefer to figure it out each time. Rules are hard to remember. But I am lucky. I don't have to solve too many too easy questions in too little time.

$\endgroup$
  • 2
    $\begingroup$ +1 for Remark Programmers know this as the fencepost or one-off problem. It is one of the most common coding mistakes $\endgroup$ – Fred Kline Oct 1 '15 at 20:23
5
$\begingroup$

Whenever you want to count the number of things, align it to the sequence $1, 2, \ldots$.

In the sequence $1,\ldots,n$, there are exactly $n$ items. This should be abundantly clear.

In the sequence $0,\ldots,n$, there are exactly $n+1$ items. This should be abundantly clear once you understand the first statement.

When you ask "How many numbers are there between 30 and 40?" and you answer "10" instinctively, you've done subtraction. Subtraction starts you at 0, not 1 -- if we subtract 30 from every number between 30 and 40, the sequence becomes $0, \ldots, 10$.

Instead of subtracting the first number, I always subtract the number that gets me to 1 -- here, 29 (i.e., 30-29=1). And 40-29 is 11. Or, if you prefer, just add 1 to 10, in parallel to the $0,\ldots,10$ argument.

$\endgroup$
0
$\begingroup$

You can use the idea of Arithmetic Progression.

$$t_n=a+(n-1)d$$ in any arithmetic progression where $t_n$ is the $n-th$ term which readily implies that $n\in\mathbb Z$.

For your first example. Between $250$ and $350$ the first multiple of $3$ is $252$ and the last multiple is $348$ and this forms an AP. So, we can write-$$348=252+(n-1)\times3$$ Solving you readily get $n=33$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.