improved performance of prob 5 by only checking multiples of largest divisor