I ran into an unexpected problem in the programming class: these kids
can't do simple math. They couldn't figure out how to make changes (i.e.
items cost 12.74, given 20.00, print the number of coins to return).
They couldn't even follow an explanation of how to convert a number of
the numeric keypad (on the right of your keypad) into its row and
column!

Now, I'm willing to give them a pass for the "making change" problem,
since that involves finding the remainder after division. I don't know
why *why* I'm willing to forgive them for being unable to grasp a piece
of grade 5 math (I think), but I am. Maybe it's just because the numbers
can have four digits.

But the numeric keypad?!? Going from 7 => (0,0), 5 => (1,1), 1 => (2,0),
etc?! This is math on SINGLE DIGITS.

Hey, as an exercise, stop reading the blog and try to figure out the
forumlae. You need one to calculate the row number, and one to do the
column number. I'm really curious about whether you find it hard.

Go on, try it. I'll wait. Here's what the keypad looks like, in case
you're on a laptop and can't remember:

7 8 9
4 5 6
1 2 3

If you want a hint, try subtracting 1 from the numeric keypad numbers,
so that you have numbers like this:

6 7 8
3 4 5
0 1 2

Another hint? Well, the numbers in the left-most column are 6, 3, 0.
Those are all divisible by 3, giving us 2, 1, 0. In fact, if you divide
any number by three and round down, you'll get 2, 1, 0 (depending on
which row it's in).

But we want the reverse of those: 0, 1, 2. How can we get from 2, 1, 0
to 0, 1, 2?

Right, we just take 2-x. Putting this all together, we have:

row = 2 - (number-1)/3
(if we always round down the division by 3; the computer does that
automatically when we do arithmetic on integers)

Once we have the row number, subtracting three times that value from the
initial number gives us:

0 1 2
0 1 2
0 1 2

So it's trivial to figure out what the column is. On the computer, we
can use the remainder ("%" -- it looks kind-of like a division slash
"/") operation:

row = (number-1)%3

I *really* didn't think that this was hard, but the kids were watching
me explain this like I was proving the central limit theorem or
something. This left me quite sad -- how badly can the high school
system fail students such that university-level children can't do this
kind of simple math?!?!

Anybody with experience teaching first-year students, or advanced high
school students: am I being unreasonable here? And do you have any tips
about how to get them comfortable with such math? Unfortunately, being
able to solve problems like this is rather critical to programming, but
this course is already pretty full as it is. I really don't think I can
afford to spend two weeks on "math thinking" exercises, even though
that's what they desperately need. :(

On the plus side, giving a lecture to them was *really* fun. It was in
one of the lecture theatres in the engineering building, which has real,
honest-to-goodness blackboards. Blackboards with decades of chalk
powdered onto them. I'm also not familiar with chalk (in the past, I've
always lectured from pdf slides or with a whiteboard), so I kept on
wiping my hands on my jeans or sweater. I was covered in chalk by the
end of the hour... it was just like being a kid and playing in the mud.
You know, when you get completely filthy and you know it'll take ages to
clean up, but you're having too much fun getting dirty to care? Just
like that, but instead of mud or snow, I was (figuratively) rolling
around in chalk.