Computes a factor for a modifier.
487330
def modifierFactor(chart, factor, factorObj, otherObj, aspList):
    
    
    asp = aspects.aspectType(factorObj, otherObj, aspList)
    if asp != const.NO_ASPECT:
        return {
            'factor': factor,
            'aspect': asp,
            'objID': otherObj.id,
            'element': otherObj.element()
        }
    return None
675664
def factor(base = nil)
      return AVERAGE_FACTOR if base.nil?
      return calculation(1, base) if atom.zero?

      calculation(atom, base)
    end
515943
def _modulo(self, decimal_argument):
        
        _times, remainder = self._context.divmod(decimal_argument, 100)

        # match the builtin % behavior by adding the N to the result if negative
        return remainder if remainder >= 0 else remainder + 100
1363978
private BigInteger computeNfactdivkNkFact(final int n,
                                              final int k)
    {
        final int nminusk = n - k;

        BigInteger kfactTimesnmkfact = factorial(k).multiply(factorial(nminusk));
        BigInteger nfactorial = factorial(n);

        return nfactorial.divide(kfactTimesnmkfact);
    }
95763
def factor(base = nil)
      valid_base?(base)

      return AVERAGE_FACTOR if base.nil?
      return adjusted_factor(1, base) if atom.zero?

      adjusted_factor(atom, base)
    end
687647
function computeFactorial(number) {
    number = Number(number);
    if (!(_regex.regex.positiveInteger.test(String(number)) || number === 0)) {
        throw new Error("number should be 0 or positiveNumber but got " + number);
    }
    if (number === 0) {
        return 1;
    }
    var result = 1;
    for (var i = 2; i <= number; i++) {
        result *= i;
    }
    return result;
}
1049110
function(symbol, factors) {
                if(symbol.isConstant() || symbol.group === S) return symbol;
                var poly = new Polynomial(symbol);
                var sqfr = poly.squareFree();
                var p = sqfr[2];
                //if we found a square then the p entry in the array will be non-unit
                if(p !== 1) {
                    //make sure the remainder doesn't have factors
                    var t = sqfr[1].toSymbol();
                    t.power = t.power.multiply(new Frac(p));
                    //send the factor to be fatored to be sure it's completely factored
                    factors.add(__.Factor.factor(t));
                    return __.Factor.squareFree(sqfr[0].toSymbol(), factors);
                }
                return symbol;
            }
653929
def discretize(value, factor=100):
    """"""
    if not isinstance(value, Iterable):
        return int(value * factor)
    int_value = list(deepcopy(value))
    for i in range(len(int_value)):
        int_value[i] = int(int_value[i] * factor)
    return int_value
1183380
function modPlus(x, y){
        var low = (x & 0xFFFF) + (y & 0xFFFF),
            high = (x >> 16) + (y >> 16) + (low >> 16);

        return (high << 16) | (low & 0xFFFF);
    }
623243
void cffti() {
		if (n == 1)
			return;

		final int twon = 2 * n;
		final int fourn = 4 * n;
		double argh;
		int idot, ntry = 0, i, j;
		double argld;
		int i1, k1, l1, l2, ib;
		double fi;
		int ld, ii, nf, ip, nl, nq, nr;
		double arg;
		int ido, ipm;

		nl = n;
		nf = 0;
		j = 0;

		factorize_loop: while (true) {
			j++;
			if (j <= 4)
				ntry = factors[j - 1];
			else
				ntry += 2;
			do {
				nq = nl / ntry;
				nr = nl - ntry * nq;
				if (nr != 0)
					continue factorize_loop;
				nf++;
				wtable[nf + 1 + fourn] = ntry;
				nl = nq;
				if (ntry == 2 && nf != 1) {
					for (i = 2; i <= nf; i++) {
						ib = nf - i + 2;
						int idx = ib + fourn;
						wtable[idx + 1] = wtable[idx];
					}
					wtable[2 + fourn] = 2;
				}
			} while (nl != 1);
			break factorize_loop;
		}
		wtable[fourn] = n;
		wtable[1 + fourn] = nf;
		argh = TWO_PI / (double) n;
		i = 1;
		l1 = 1;
		for (k1 = 1; k1 <= nf; k1++) {
			ip = (int) wtable[k1 + 1 + fourn];
			ld = 0;
			l2 = l1 * ip;
			ido = n / l2;
			idot = ido + ido + 2;
			ipm = ip - 1;
			for (j = 1; j <= ipm; j++) {
				i1 = i;
				wtable[i - 1 + twon] = 1;
				wtable[i + twon] = 0;
				ld += l1;
				fi = 0;
				argld = ld * argh;
				for (ii = 4; ii <= idot; ii += 2) {
					i += 2;
					fi += 1;
					arg = fi * argld;
					int idx = i + twon;
					wtable[idx - 1] = Math.cos(arg);
					wtable[idx] = Math.sin(arg);
				}
				if (ip > 5) {
					int idx1 = i1 + twon;
					int idx2 = i + twon;
					wtable[idx1 - 1] = wtable[idx2 - 1];
					wtable[idx1] = wtable[idx2];
				}
			}
			l1 = l2;
		}

	}
1024219
function mod(n, m) {
  const q = n % m;
  return q < 0 ? q + m : q;
}
369913
def _prodterm(lexer):
    """"""
    factor = _factor(lexer)
    prodterm_prime = _prodterm_prime(lexer)
    if prodterm_prime is None:
        return factor
    else:
        return ('and', factor, prodterm_prime)
1306916
function(symbol, factors) {
                if(symbol.isComposite()) {
                    var gcd = core.Math2.QGCD.apply(null, symbol.coeffs());
                    if(!gcd.equals(1)) { 
                        symbol.each(function(x) {
                            if(x.isComposite()) {
                                x.each(function(y){
                                    y.multiplier = y.multiplier.divide(gcd);
                                });
                            }
                            else x.multiplier = x.multiplier.divide(gcd);
                        });
                    }
                    symbol.updateHash();
                    if(factors) 
                        factors.add(new Symbol(gcd));
                }
                return symbol;
            }
994395
def redivmod(initial_value, factors):
    
    result = []
    value = initial_value
    for divisor, label in factors:
        if not divisor:
            remainder = value
            if not remainder:
                break
        else:
            value, remainder = divmod(value, divisor)
            if not value and not remainder:
                break
        if remainder == 1:
            # depluralize
            label = label[:-1]
        if six.PY2:
            addition = unicode(remainder) + ' ' + unicode(label)
        else:
            addition = str(remainder) + ' ' + str(label)
        result.insert(0, addition)
    if len(result) > 1:
        result[-1] = "and " + result[-1]
    if result:
        return ', '.join(result)
    else:
        return "instantly"
8486
def phi( n ):
  """"""

  assert isinstance( n, integer_types )

  if n < 3: return 1

  result = 1
  ff = factorization( n )
  for f in ff:
    e = f[1]
    if e > 1:
      result = result * f[0] ** (e-1) * ( f[0] - 1 )
    else:
      result = result * ( f[0] - 1 )
  return result
1345204
public List<UnitValue> getFactors(Unit base, RoundingMode mode, Unit...units) {
    List<UnitValue> result = new ArrayList<>();
    for (int i = 0; i < units.length; i++) {
      UnitFactor factor = resolve(units[i], base);
      if (factor != null) {
        BigDecimal n = factor.rational().compute(mode);
        result.add(new UnitValue(n, units[i]));
      }
    }
    return result;
  }
901993
def _compute(self):
        """"""
        self.min_ = self._min or 0
        self.max_ = self._max or 0
        if self.max_ - self.min_ == 0:
            self.min_ -= 1
            self.max_ += 1

        self._box.set_polar_box(0, 1, self.min_, self.max_)