From: Sam Kong Date: 2007-01-24T06:22:49+09:00 Subject: Re: I need a more efficient algorithm for this problem. Hi Rob, Rob Biedenharn wrote: > These are Catalan numbers which you can learn more about on Wikipedia > [1] or MathWorld[2]. If you just need to know the number of > solutions, both references give a formula. > > -Rob > > [1] http://en.wikipedia.org/wiki/Catalan_number > [2] http://mathworld.wolfram.com/CatalanNumber.html Thank you for the information. That's almost what I was looking for. Catalan numbers are for combinatorics not for partitions in that the order of numbers is significant in combinatorics. Anyway, the documents will give me hints. And at least, now I know that Mathematica provides the function. I can install Mathematica if I need to. I'm trying to solve math problems in projecteuler.net . They are very helpful when you want to apply your coding skills to solving problems. (Similar to ruby quiz but more math-oriented.) Some problems require math knowledge, though. (Brute force won't help.) It's fun. I hope more Ruby programmers will join it and challenge. It shows staticstics which compares languages. There are not many ruby users there yet. Thanks again. Sam