Calculate divisors of each integer from 1 to n