> > 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. > > Its fairly easy to calculate the maximum digit in the > triangle without calculating all the rows (basically O(N)). I found a pretty good explanation on [1]. I'm not a mathematician, but I know how to use this information. So, since we calculate the biggest number on the last row before we start, it's possible to iterate over all rows only once. There's absolutely no need to remember the whole triangle. Good. Thanks. gegroet, Erik V. - http://www.erikveen.dds.nl/ [1] http://www.mathwords.com/b/binomial_coefficients_pascal.htm