예제 #1
0
        /// <summary>
        /// Calculate the number using the Binomial Coefficients algorithm
        /// </summary>
        public static ulong GetNumberByBinomialCoefficients(uint rank)
        {
            // Calculate value of 2nCn
            var catalanNumber = BinomialCoefficients.Calculate(2 * rank, rank);

            // return 2nCn/(n+1)
            return(Convert.ToUInt64(catalanNumber / (rank + 1)));
        }
        /// Calculate the number using the Binomial Coefficients algorithm

        public static BigInteger GetNumberByBinomialCoefficients(uint rank)
        {
            // Calculate by binomial coefficient.
            return(BinomialCoefficients.Calculate(rank));
        }