first [ i ] and second [ i ] are going to store maximum multiples of i in a [ ] and b [ ] respectively .
let first = Array . from ( { length : N } , ( _ , i ) => 0 ) ; let second = Array . from ( { length : N } , ( _ , i ) => 0 ) ;