> > Building the triangle takes 54 bytes. > > > > (Storing it will cost you 2 extra bytes. The question is: > > Do you want to store it?) > > If you don't want to store it, and predefine a certain > function (which means that you no longer need to store it, > incidentally), the entire triangle can be calculated in 37 > bytes. However, that makes the overall program longer... Personally, I don't build the triangle at all. I mean, I don't store the whole triangle in any place. If you try to remember the whole triangle, you'd need a lot of memory. If you iterate over the rows, building the next one based on the previous one and forgetting the previous one instantly, can be done in a (memory-) cheap way (with just 31 bytes or Ruby code...). The only problem with this is that you need to know the maximum cell width (on the last row) when you build the first one. So I iterate twice over all rows. The first time to determine the last row and its biggest cell and the second time to format and print each row. In this situation, the maximum number of cells in memory at any time, is roughly twice the number of cells on the last row, more exactly N*2-1 (which could probably be reduced to N or even N/2+1). When you try to remember the whole tree, you need to remember N*(N+1)/2 cells, or about N^2/2 cells. My point is: Space is limited by nature, Time isn't. Or, in the world of programming: It's usually better to eat CPU cycles than MB's. Especially when you think big... I don't say that it's faster, but you can simply build bigger triangles. gegroet, Erik V. - http://www.erikveen.dds.nl/