The earliest memory I have of ‘programming’ is in the early/mid 90s when my father brought home a computer from work. We could play games on it … so of course I took the spreadsheet program he used (LOTUS 123, did I date myself with that?) and tried to modify it to print out a helpful message for him. It … halfway worked? At least I could undo it so he could get back to work…

After that, I picked up programming for real in QBASIC (I still have a few of those programs lying around), got my own (junky) Linux desktop from my cousin, tried to learn VBasic (without a Windows machine), and eventually made it to high school… In college, I studied computer science and mathematics, mostly programming in Java/.NET, although with a bit of everything in the mix. A few of my oldest programming posts on this blog are from that time.

After that, on to grad school! Originally, I was going to study computational linguistics, but that fell through. Then programming languages (the school’s specialty). And finally I ended up studying censorship and computer security. That’s about where I am today!

But really, I still have a habit of doing a little bit of everything. Whatever seems interesting at the time!

Factoring factorials

There was a new post on Programming Praxis a few days ago that seemed pretty neat:

Given a positive integer n, compute the prime factorization, including multiplicities, of n! = 1 · 2 · … · n. You should be able to handle very large n, which means that you should not compute the factorial before computing the factors, as the intermediate result will be extremely large.

read more...


Graph coloring

Here’s another one from /r/dailyprogrammer:

… Your goal is to color a map of these regions with two requirements: 1) make sure that each adjacent department do not share a color, so you can clearly distinguish each department, and 2) minimize these numbers of colors.

Essentially, graph coloring.

read more...


Graph radius

Here’s a quick problem from the DailyProgrammer subreddit. Basically, we want to calculate the radius of a graph:

radius(g) = \min\limits_{n_0 \in g} \max\limits_{n_1 \in g} d_g(n_0, n_1)

read more...


Overlapping circles

Here’s a quick little programming task that I came to via a post on L2Program (who in turn seems to have found it on Reddit). The basic idea is to take a given list of circles and to determine the area enclosed (while correctly accounting for overlap).

read more...


Edges to adjacency

Another quick one, this time from /r/dailyprogrammer:

Your goal is to write a program that takes in a list of edge-node relationships, and print a directed adjacency matrix for it. Our convention will follow that rows point to columns. Follow the examples for clarification of this convention.

read more...


Twitter puddle

This one has been sitting in my backlog for a while and its been a while since I’ve gotten to write a programming post1, but now seems as good time as ever: Twitter puzzle

read more...


Making music, part 3: Making noise

Last week we parsed some music. That post was in a bit of a hurry, so we had to leave off a fair few important pieces (like ties and slurs for one; chords for a rather bigger one). We’ll get to them soon, but for now we want to actually get something playing back.

read more...


Making music, part 2: Taking shape

It’s been a bit, but as you may have noticed life is a bit mad at the moment. But I’ve still made some progress.

When we left off last time, we’d finished the first step towards making some lovely music with Racket: tokenization. Now we want to take those songs and form them into something actually approaching music.

read more...