Algebra.js
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;
            }
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;
            }
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 ; }
Removes GCD from coefficients
@param {Symbol} symbol
@param {Factor} factors
@returns {Symbol}
Removes GCD from coefficients