top | item 17376408

(no title)

mdellabitta | 7 years ago

I was taught basic counting, addition, and subtraction using a finger-abacus system called Chisanbop: https://en.wikipedia.org/wiki/Chisanbop

Now I'm plagued by off-by-one errors in my mental math, particularly when it comes to intervals. If you ask me how many days there are between now and Christmas, I will be uncertain about the answer unless I individually count them all off on my fingers.

discuss

order

darkerside|7 years ago

Yeah, that's not an uncommon malady. That's why off-by-one errors are one of the two most common errors in computer programming, along with naming things and cache invalidation.

chalence|7 years ago

Thanks for the chuckle.

darkmighty|7 years ago

Just use little inductive proofs. How many days lie between day 3 and day 37? Is it 37-3=34 or maybe 37-3-1=33?

Well, between day 1 and day 3 there is 1 day. By finite induction between day n>3 and day 1, there are n-2 days, and analogously between days n>k>1 there are n-k-1 days.

lopmotr|7 years ago

It's embarrassing but that's what I routinely do when declaring and indexing arrays. I imagine an array with 2 items (index 0 and index 1) and say "that's got length 2 and maximum index 1", so for my length 50 array, the maximum index will be 49. Similarly for intervals and 1-based arrays, etc. All of that talking to myself over and over again! I almost never get off-by-1 errors though. It's a good reason to use iterators instead of for loops.

com2kid|7 years ago

> I was taught basic counting, addition, and subtraction using a finger-abacus system called Chisanbop: https://en.wikipedia.org/wiki/Chisanbop

I was just taught counting using it, it was a quick bonus math class one day.

It is super useful for counting things off without losing place. Even being able to go up to 10 on just one hand is useful.

wodenokoto|7 years ago

I think everybody are uncertain about such a question, when it is not between 1st and 24th of december.

SagelyGuru|7 years ago

Clearly it is the difference between the two numbers plus one if both are to be included in the result and the difference minus one if both are excluded. That is because the conventional difference excludes the one being subtracted but includes the other one. Think of it as set difference.

jedimastert|7 years ago

I kinda do the same thing, except I tap my other fingers on my thumb instead of holding them over a table. I might start doing that though.