/// <summary>
        /// Returns the outpur of (n k)
        /// </summary>
        /// <param name="lElementsInSet"></param>
        /// <param name="lElementsInSubset"></param>
        /// <returns></returns>
        public long GetNumberOfCombinations(long lElementsInSet, long lElementsInSubset)
        {
            long lStopAt;
            long comb;

            if (lElementsInSet < lElementsInSubset)
            {
                return(0);
            }

            lStopAt = lElementsInSet - lElementsInSubset;

            if (lStopAt < lElementsInSubset)
            {
                lStopAt = lElementsInSubset;
                comb    = CMath.Factorial(lElementsInSet, lStopAt) / CMath.Factorial(lElementsInSet - lElementsInSubset, 1);
            }
            else
            {
                comb = CMath.Factorial(lElementsInSet, lStopAt) / CMath.Factorial(lElementsInSubset, 1);
            }

            return(comb);
        }
Esempio n. 2
0
 /// <summary>
 /// Returns the LCM of all numbers
 /// </summary>
 /// <returns></returns>
 public double GetLCM()
 {
     return(CMath.LCM(periods));
 }