vector to store all the prime factors along with their number of occurrence in factorization of k
let ans = [ ] ; for ( let i = 2 ; k != 1 ; i ++ ) { if ( k % i == 0 ) { let count = 0 ; while ( k % i == 0 ) { k = Math . floor ( k / i ) ; count ++ ; } ans . push ( new pair ( i , count ) ) ; } } return ans ; }