Ejemplo n.º 1
0
        // Reduce this vs thatList
        public void CalcLowestCommon(ref CPrimeFactorList thatList)
        {
            int intThis = 0;
            int intThat = 0;

            for (intThis = 0; intThis < Count; ++intThis)
            {
                CPrimeFactor thisPrimeFactor = this[intThis];
                intThat = thatList.Find(thisPrimeFactor.Prime);
                if (intThat >= 0)
                {
                    CPrimeFactor thatPrimeFactor = thatList[intThat];
                    while (thisPrimeFactor.Count > 0 && thatPrimeFactor.Count > 0)
                    {
                        thisPrimeFactor.Decrement();
                        thatPrimeFactor.Decrement();
                    }
                }
            }
            if (_remainder == thatList._remainder)
            {
                _remainder          = 1;
                thatList._remainder = 1;
            }
            CleanUp();
            thatList.CleanUp();
            Recalc();
            thatList.Recalc();
        }
Ejemplo n.º 2
0
        // Reduce this._value vs. intThatValue
        public void CalcLowestCommon(ref int intThatValue)
        {
            CPrimeFactorList thatList = new CPrimeFactorList(intThatValue);

            CalcLowestCommon(ref thatList);
            intThatValue = thatList.Value;
        }