cyber,
<script>
function combinator(matrix){
return matrix.reduceRight(function(combination, x){
var result = [];
x.forEach(function(a){
combination.forEach(function(b){
result.push( [ a ].concat( b ) );
});
});
return result;
});
};
var arr = combinator([ [ 0, 10, 20, 30, 40, 50 ],[0, 7, 14, 21],[0, 8, 16, 24],[0, 1, 2, 3, 4, 5, 6, 7]] );
arr = arr.filter(function(a) {
return 55 == a.reduce(function(a,b) {
return a + b
})
})
document.write(
arr.join("<br>")+ "<br>Всего вариантов : " + arr.length
);
</script>