Yes, I do like Rick's suggestion of the zero coefficients for the higher powers, plus there is a completely natural way of getting there using the gamma function. This, I imagine, is the mechanism behind the Wolfram Alpha and Google implementations of the n choose r function. If I write my own version of the COMB function: start icomb(n, r); return( round( gamma(n + 1) / (gamma(r + 1) # gamma(n - r + 1 + 1E-12)))); finish; all I need to do is add on a tiny amount to prevent any attempt at evaluating the gamma function exactly at zero, or at one of the negative integers, round the result and I have a function that can handle r>n. Then I can have that elusive one line solution for the generation of the Pascal matrix. Start Pascal( n ); return( icomb( row(j(n,n)) - 1, col(j(n,n)) - 1 ) ); finish; print ( Pascal(12) ) [f=3.0]; As for utility of the modified function, I admit it is limited as I have been using the COMB function for some years and this is the first time I have tried using it with r>n, but my expectation was that it would perform like ICOMB above. ICOMB may not be robust and only work with smaller n, and my original Pascal function contains 3n^2 unnecessary multiplications in its desperate attempt to retain 'elegance' while circumventing the invalid argument issues, so thanks to Rick for the alternative suggestions. Actually I prefer the shorter function with the loop rather than the fully vectorized version!
... View more