示例#1
0
        public static MultiSet <long> Factorize(this long n)
        {
            var factors = new MultiSet <long>();

            for (long i = 2; i *i <= n; i++)
            {
                while (n % i == 0)
                {
                    n /= i;
                    factors[i]++;
                }
            }
            if (n > 1)
            {
                factors.Add(n);
            }
            return(factors);
        }
示例#2
0
 public MultiSet(MultiSet <T> source) : this(source.occurrence)
 {
 }