Store the frequencies of all the distinct primes
let b = new Array ( ) ; let dp = new Array ( ) ; let sum = 0 ; for ( let i = 0 ; i < l ; ) { let count = 1 , x = a [ i ] ; i ++ ; while ( i < l && a [ i ] == x ) { count ++ ; i ++ ; }