I'm trying to think of an elegant way to draw Sierpinski Triangles, perhaps using my screensaver library (see ~kfogel/screensavers/). Here's what I've got so far: -------------------------------------------------------------------------- TRIANGLE (A, B, C) => draws a triangle with corners A, B, C. (Each var is a struct point { int x, y };). MIDPOINT (N, M) => returns the midpoint of line from N to M. (Each var is a struct point { int x, y };). Let us call the number of iterations the "depth" of the triangle. So a triangle with a depth of 0 contains 3 lines/1 triangle, a depth of 1 implies 6 lines/5 triangles, depth 2 implies 15 lines/14 triangles... hmm, let's make a table: depth triangles lines ----- --------- ----- 0 1 3 1 5 6 2 14 15 3 50 4 5 6 One triangle becomes five triangles on the next iteration, if it gets divided, and three out of four triangles *do* get divided. 1 3 6 10 15 21 28