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