public class TestHeshu {
static int heshu(int shu) {
//如果 shu是质数,直接 返回shu
Test123 tt = new Test123();
if (tt.isZhiShu(shu)) {
log.info("已经是质数:" + shu);
return shu;
}
for (int a = 2; a <= shu / 2; a++) {
if (shu % a == 0) {
log.info("合数是:" + a);
int jieguo = shu / a;
// log.info("jieguo="+jieguo);
int x = heshu(jieguo);
// log.info("合数是:" + x);
return x;
////////
}
}
return shu;
}
}