For each number i we will go to each of the multiple of i and update the count of divisor of its multiple j as i is one of the factor of j
for ( int i = 1 ; i < N ; i ++ ) { for ( int j = i ; j < N ; j += i ) { divi [ j ] ++ ; } } }