Learning How to Count (Avoiding The Fencepost Problem)

Counting isn't easy. Suppose your boss wants you to work from 8am to 11am, and mop floors 8 to 11. Simple - it's one floor per hour, right?

This is a companion discussion topic for the original entry at http://betterexplained.com/articles/learning-how-to-count-avoiding-the-fencepost-problem/

Your article prints out several question marks and symbols instead of the characters. I’m in the U.S. and it’s displaying that way both in Safari and Firefox.

It looks like a copy-paste from Word.


For your reference… that’s how your most recent blog entry looks in Safari on a Mac. RSS feed in Mail.app is the same. In Camino, I get regular ?s instead of the diamond icons.

Your past entries are fine.

Thanks for the fast response guys! I was using a new publishing process and didn’t realize it had all these issues – fixing them up right now.

Ok, the weird characters should be fixed. Thanks again for the notice everyone!

That’s a great explanation. I really like your articles (this is a problem that always frustrates me, as well).

The mathematical terms for that would be inclusive or exclusive, if anyone remembers “sets” from elementary school (or junior high - it’s been awhile). Inclusive means add the 1 (count the number of items), and exclusive means don’t add it (tell me the distance between).

The difference is caused by the adoption of closed intervals in our language. When we say “all integers between 1 and N”, we mean N numbers (i.e., we include the both the boundaries).

It is often more convenient (at least in programming) to work with half-open intervals. Consider a standard way of cycling through N numbers in C-like languages:

for (int i = 0; i

We mention boundaries 0 and N, yet we only mean N numbers, not N+1.

You can read more about this in Dijkstra’s note: Why numbering should start at zero.

The code snippet in my comment above should read:

for (int i = 0; i < N; i++)

Sorry about that.

Interesting post on a common issue. Thanks!

[…] Kalid placed an interesting blog post on Learning How to Count (Avoiding The Fencepost Problem …Here’s a brief overviewWhat Does Subtraction Mean? We often see numbers as points on a line: These points can be houses, floors, or plain integers. Whatever they are, they’re labeled so we can count them easily. 1 to 10 means ten items. …. It looks like a copy- paste from Word. Slari — April 28, 2009 @ 6:50 am. www.atchius.net/betterexplained.png. For your reference… that’s how your most recent blog entry looks in Safari on a Mac. RSS feed in Mail.app is the same. In Camino, I get regular ?s … […]

Thanks Marian, that link was interesting too. It was an excellent
argument, but I didn’t understand the bit around what follows.
‘Latter’ refers to examples (a) and ©. I don’t follow why inclusion
of the upper bound would force the upper bound to be unnatural as the
set shrinks to the empty set. (sorry about the awkward use of the word
bound) Given 2 =< i =< 3 we have {2,3}, given 2 =< i =< 2 we have
only {2}, with 2 =< i < 2 we still have {2} (or nonsense).

Is it because beginning with zero you can’t show the empty set with
approach ©, but you can with the (a)?

The passage: “Consider now the subsequences starting at the smallest
natural number: Inclusion of the upper bound would then force the
latter to be unnatural by the time it had shrunk to the empty one.”

Thanks a lot for your article. I never looked at counting numbers like this before.

A very clear and easy explanation of things.

Looking forward to more posts from you. :slight_smile:

[…] read-more […]

Thanks for the article. I love when you post new stuff.

Please, keep posting :slight_smile:

Great post. I like the idea of thinking in spans and also physical entities. It’s something we all do but maybe have not consciously thought about it.

This reminded me of how the years of the 1800’s are the 19th century (and not the 18th century).

Keep em coming!

@Phil, @ Marian: Thanks for the details! Yes, it’s interesting how certain types of time ranges imply inclusive or exclusive ranges. We tend to “know” which one to use given the context and/or idioms like the for loop (always start at 0, always be less than N).

@Queryman: I think my form may have eaten your comment, I think you may have written “Given 2 = i”

@Scientific Chick: Thanks!

@Ismeet: You’re welcome, appreciate the encouragement :slight_smile:

@Tiago: Thanks!

@CL: Ah, that 19th centry / 1800s issue has been on my mind too, great example. The first “span” of a hundred years (century) is from year 1 to 100, leading to all the confusion we now suffer. Will try to keep them coming :).

OMG! That’s how I’ve envisioned counting things/distances/etc for years! I thought I was the only one! I always said “you have to start at the beginning of 5, but you go to the end of 8” so that makes 4 not 3!

Music is written in such a way. Bar lines are the points for counting measures, so that statements like “four measures back” aren’t ambiguous.

When I began numbering my scores, I noticed that a four measure rest starting at measure 21 encompasses spans 21-22, 22-23, 23-24, and 24-25, but it only numbers 21-24, because the measure between 24 and 25 is numbered 24. That was the epiphany that there are two different counting systems, and that they must coexist.

@Jehan: Nice! It’s really cool figuring out the tricks other people use to handle potentially confusing topics.

@Nobody: Great example with music. I think it makes sense, as music must convey timing accurately and clearly. It’s an interesting solution to just “number the fence pieces” to avoid confusion about what 4 measures back means. Thanks for the example.