public IntegerSym jacobiSymbol(IntegerSym b) { if (this.compareTo(IntegerSym.valueOf(1)) == 0) { return IntegerSym.valueOf(1); } if (this.compareTo(IntegerSym.valueOf(2)) == 0) { return b.jacobiSymbolF(); } if (!isOdd()) { return this.quotient(IntegerSym.valueOf(2)).jacobiSymbol(b).multiply(IntegerSym.valueOf(2).jacobiSymbol(b)); } return b.quotient(this).jacobiSymbol(this).multiply(jacobiSymbolG(b)); }