work in progress. need optimizationto handle large number of divisor