## When I was twelve years old

When I was twelve years old I implemented my very first computer program. I didn’t have any knowledge of programming, and they didn’t teach any courses in our middle school, so I needed to figure it out for myself.

It was an odd little computer, that I just happened to come upon in the school library. It was really more of a programmable calculator with a paper tape that printed numerical results. Its programming language, such as it was, was a kind of weird assembly language — although I wouldn’t learn about the term “assembly language” until some years later.

I decided to write a program to play a game of tic-tac-toe. To do this, I needed to store which of the nine squares had an X, and which squares had an O. Except this little programmable calculator didn’t support arrays, so I had to figure out another way.

If I’d known more, I would have used some kind of binary encoding. But all I knew was that the calculator could store extremely large numbers. So instead I used what now seems like a really crazy scheme.

I figured out that if you multiply any the numbers from 61 through 69 together, you always get a result that isn’t a multiple of any of the numbers you didn’t use. For example, if 61*62*64*66*67 is not a multiple of 63 or 65 or 68 or 69.

This works for any such combination of the numbers 61 through 69. It doesn’t work for any consecutive run of numbers smaller than that — I checked.

I used that scheme to encode which squares had Xs and which squares had Os. After that, it was easy to program a tic-tac-toe game.

Now that I think back on it, this was a very weird approach to the problem of storing combinations of nine numbers in a computer. But hey, it worked!