Click here to see the full article post
I think the last line: return a < 2 && res <= Integer.MAX_VALUE ? (int)res : 0;
use a < 10 is more understandable then a < 2, since a < 10 means the remaining a has to contains only one digit to meet the algorithm
a == 1 would make more sense... because
a should be completely factorised.