Function that finds the shortest subsequence
function findShortestSubsequence ( dp , a , index , primeFactors ) { let n = a . length ; for ( let j = index ; j < n ; j ++ ) { let bitmask = 0 ; for ( let p = 0 ; p < primeFactors . length ; p ++ ) {