while(!found&&(m.signum()==1&&f.signum()==1)){//loop when not found and values are not negative
intcomp=m.compareTo(f);
if(comp>0){
BigInteger[]vals=f.equals(BigInteger.ONE)?//dividing one is the only case where it will not be equivalent to multiple subtraction, thus we must make an exception