ProperDivisor algorithm