Counting in Chinese

You learn the basics of counting numbers in Chinese. Also, there was a lot of wind. And my camera battery threatened to die on me, hence the hurried nature. I also counted from 1 to 10 in Cantonese, Hokkien and Japanese.

To those participating in VEDA, you made it! VEDA stands for “Vlog Every Day (in) April”. It appears to be a thing that happens on YouTube. There’s also VlogMAFIA, which stands for “Vlogs May Appear Frequently In April”. YouTube people are fun…

“The numbers don’t tally!” – a serial counting problem

Boy in shock

How many numbers are there from 7 to 26 (both inclusive)? How do you calculate your age?

Both solutions require you to count from one number to another. And if you’re quick-witted, you might have deduced that a subtraction shortens the process considerably. However, be careful of how you subtract.

For the first question, if you take 26 – 7, you get 19. But there are 20 numbers:
7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26

For the second question, you simply take the current year minus the year you were born in (let’s leave the exact months out of this). So I’m born in 1977, and as of this writing, it’s the year 2009, so I’m 2009 – 1977 = 32 years old. Which is correct. Wait, did I just tell you my age?

The army equipment

I’m going to relate to you an incident which happened when I was enlisted in the army. No it’s not a war story. It is, surprisingly, a counting problem.

I was a lowly private then, assigned to the store to help. On a particular day, the lance corporal I was helping was making sure of equipment stock. Basically ensuring that the stock number of a piece of equipment on paper, physically reflects the stock number of that piece of equipment in the store.

We took down all the (communications, I think) equipment down from the racks, and placed them neatly on the floor. Since the racks were now empty, we might as well clean them (army efficiency…). After that, the lance corporal and I started to count the equipment on hand.

It was a while later, and I was counting my part of the equipment, when the lance corporal swore. He was pacing, and gesticulating, and his face was contorting in expressions of worry I’ve never seen before.

“You ‘A’ level right? The numbers don’t tally! Tell me what’s wrong!” *

The lance corporal had counted the pieces of equipment. It tallied with what was recorded on paper. Then he sorted them by serial number (there was one on each piece of equipment). Then he matched them with the serial numbers recorded in the system. It was correct too.

And because the serial numbers were in increasing order, differing by 1, he did the subtraction trick. And found to his horror of horrors that it wasn’t the number he counted! Hence his panic.

Let’s say the serial numbers were:
SERIAL0007
SERIAL0008
SERIAL0009

SERIAL0024
SERIAL0025
SERIAL0026

The records said there were 20 pieces of this equipment on hand. But the subtraction gave him:
26 – 7 = 19!

What went wrong?

The problem was, the lance corporal didn’t count the equipment with serial number SERIAL0007.

The age problem

Let’s look at the age problem again. Say there’s a baby born in the year 2000. Which year would the baby be 1 year old? 2001. Which year would the baby be 5 years old? 2005.

How is the age calculated? Take the current year minus the birth year.

It works, because the birth year is not counted.

Back to the serial numbers

In the case of the serial numbers, each serial number had to be counted in.

Serial numbers SERIAL0007 and SERIAL0008 means there were 2 pieces of equipment, even though
8 – 7 = 1

Thus, the number of pieces of equipment for serial numbers SERIAL0007 through to SERIAL0026 should be 26 – 7 (+ 1) = 20

Conclusion

A series of numbers is easy to count the number of its members. Just use subtraction.

Just be careful to note whether the start of the series have to be counted.

=====
* In Singapore, ‘A’ level refers to the GCE ‘A’ levels, commonly taken by students at around 18 years old. If one passes this, one can proceed to the university (generally speaking). And in Singapore, having a degree means a lot.

And young men with an ‘A’ level certificate entering the army may sometimes be viewed or referred to with a slight derogatory attitude, albeit lighthearted and with a fun undertone. And with their status sometimes pronounced as “air level”.

[image by Izmabel]

Math, culture and programming languages

Can a programmer’s background determine whether he’ll be a great programmer? By background, I mean his upbringing, the values learnt, his primary (and perhaps secondary) spoken/written language and so on.

I don’t know. However, I have arguments for and against the proposition. Let’s start with…

Learning to count

You think counting is easy? Apparently not. Recently I read a book, Outliers by Malcolm Gladwell. According to Gladwell, American children the age of four can, on average, count up to fifteen. Chinese children at that age can, on average, count up to forty.

His reasoning is that, the system of naming numbers is different in English and in Chinese.

For example, think about counting from twenty to thirty (I’m deliberately using the English form instead of the Arabic numerals to highlight the difference). You have twenty, twenty one, twenty two and so on till twenty nine and thirty. How about thirty to forty? Thirty, thirty one, thirty two and so on till thirty nine and forty.

Consider counting from ten to twenty. Ten, eleven, twelve, thirteen and so on till eighteen, nineteen and twenty. The pattern is different and irregular.

Before I show you the Chinese method of counting, let me show you the first 10 numbers, shown by the Arabic numeral, the English name and the (closest) Chinese pronunciation I can give:

1 one (yi, like in “yeast”)
2 two (er, like in “brighter”)
3 three (san, “sahn”)
4 four (si, do a short hissing sound with the s)
5 five (wu, “woo” and keep it short)
6 six (liu, “li” and “ou” as in “shoulder”, and string li-ou together quickly)
7 seven (qi, “cheese” without the s, and shorter in length)
8 eight (ba, as in “barter”)
9 nine (jiu, “gi” as in “gin” and “ou” as in “shoulder”. Like that of six.)
10 ten (shi, like that of four, with the h)

There are actually 4 tonal inflections for a Chinese character pronunciation, and we’ll ignore that for this discussion.

So to count in Chinese from ten to twenty, we have shi, shi yi, shi er, shi san, shi si, shi wu, shi liu, shi qi, shi ba, shi jiu, er shi. They are literally “ten”, “ten one”, “ten two”, “ten three” and so on till “ten nine” and “two ten”. There’s an implicit “one” in front of the “ten”, so it’s “one ten one” for eleven. For twenty three, it’s “er shi san”, or literally “two tens and three”.

Gladwell says this gives structure to the counting system, so children are able to grasp larger numbers quicker. The faster you can count to larger numbers, the more operations you can do on them. Additions, subtractions, summations and so on.

Ok, I’m not saying the Chinese number naming system is better than the English system. It’s just different. Gladwell says this difference also makes memorising short number sequences easier. For example, I can remember my Identification Card Number (equivalent to the Social Security Number in America) easier in Chinese than in English.

It explains why when someone asks for my phone number in English, I have a problem. Because I’m mentally translating my memory of the phone number from Chinese to English. Did you know it’s kinda hard to say out 8 digits in English while translating them from a Chinese memory? I can even mentally picture the numbers. It’s the speaking out that’s taking up mental processing time.

Gladwell also made a point about Cantonese (a Chinese dialect) pronunciation of numbers. So I tried saying out numbers in Cantonese (yes, I’m multilingual), and wow, it is easier to say and memorise! The Cantonese pronunciation of numbers are short in length, which makes it easier to spit them out *smile*

And the relation to programming? Programming is made up largely of counting and solutions formed from abstract ideas. When I first learned C, I was surprised that many fellow students had difficulty counting the number of iterations in say,

for (i=0; i<10; ++i)
{
	if (i>7) break;
	// do something
}

Counting and iterating leads to lists of data, or sets of data. In SQL, you can manipulate sets of data as if it’s one unit, abstracting away the fact that the data is actually iterated one by one. For example, you can select information from another data set, or a subquery as it’s known.

Of course, there are still some people who have difficulty visualising SQL data sets as one unit, hence their need to iterate over that one record by one record at a time, even when there’s no need. What does that tell you about these people?

Hard work is valued

Gladwell also made a point about culture. That successful people seem to grow up with a culture of valuing hard work. The ability to think on a problem long enough to come up with a solution.

He said something worth thinking about. There’s a educational researcher by the name of Erling Boe at the University of Pennsylvania. Boe says that one can know if a child will do well in math without asking that child a single math question.

The example in the book was a fictional Math Olympics. Before the test, there was a questionnaire to be filled in. There were tons of questions inside, none related to math. Boe asserts that a child who finishes that questionnaire will also do correspondingly just as well in the math test.

It’s a question of perseverance, the willingness to put one’s mind to work, even if one doesn’t feel like it.

Hard work is something valued in the countries of “wet-rice agriculture and meaningful work”, as Gladwell puts it. Based on the research of Boe, the top countries are Singapore (yay!), South Korea, Taiwan, Hong Kong and Japan. Though I’m not so sure of my fellow countryman’s motivations… The parents and children could be driven more by the race for top scores rather than the culture passed on by our forefathers.

Well, I haven’t read much on Boe’s research, but the hardworking nature of my countrymen is fairly accurate. Students are willing to study for long periods of time (most of them anyway…). Adults are willing to work just a little longer, a little harder at work. For example, I recently knew that my friend worked overtime till 4 am at the office. Personally, I think that’s crazy, but to each his (in this case, her) own.

The native language

There was a question in StackOverflow about coding in other spoken languages, which was highlighted in Jeff and Joel’s recent podcast.

The reserved words in a programming language are fixed. Usually they are in English, though there are programming languages in say Chinese. I didn’t know there was a Chinese version of BASIC!

Once, I took up an SQL reference book, written in Chinese. I want to mention that I cannot read a programming reference book written in Chinese. That is to say, I can certainly read the Chinese characters, but I can’t understand the heck what it means.

I need a reference book written in English for SQL, because the native (human) language for SQL is English! Unless there’s a variant I don’t know about…

I’ve seen some code written in Spanish before, I think. Can’t remember. Anyway, the native language for the programming language (C, I think) was English, so the code reads fine. The variable names look different, but I didn’t have too much difficulty.

My guess is that my math background prepared me for abstract notions and symbols, and still be able to work with them. So I treated variables named in a foreign language as just another symbol. And continued to read the code based on that.

And this brings me full circle to…

So does background really matter?

I am unfamiliar with how an American (or English, or French) grows up. I don’t really know the values valued, or the culture surrounding the upbringing of a child.

I do know mine. I’m brought up learning two languages (English and Chinese), two Chinese dialects (Hokkien and Cantonese). I taught myself to read Japanese characters. I’m brought up around people who wake up before dawn to work, and work long hours, regularly and consistently and over long periods of time.

Personal values, personality, genes and luck. I agree they play a part in the makings of a great programmer. In particular, I believe that one’s background influences personal values and personality, so in that sense, background does matter.

And specifically, I think my math background makes grasping programming concepts easier for me.

Of course, everything you’ve just read could be hogwash, because I’m still telling (interesting, I hope) anecdotes to illustrate points as Joel points out vehemently. I haven’t read a lot about computer science and its history in America (or pretty much anywhere in the world). I research just enough so that what I write is as true as I understand it (sometimes I don’t research at all!).

I admit that I’m still naive and easily impressed. I still pretty much trust what I read as true. It’s only when I start internalising the information that I really think about them.

So what do you think?