I have a variable that shows various combinations of numbers:
var sequence = [
'01-02-03-04-05-06',
'01-02-03-04-05-12',
'01-02-03-04-12-30',
'05-10-15-20-25-30',
'02-04-06-08-10-12',
'03-06-09-12-15-17',
'04-08-12-16-20-24',
'05-10-15-20-25-30'
];
This loop I created allows me to check each value of this variable separately:
for (var i=0; i<sequence.length; i++){
number = sequence[i].split('-');
for (var j=0; j<number.length; j++){
number = number[j];
}
};
From then on I couldn't advance the argument. I don't often work with loops and I get a bit lost. I need help and guidance to achieve get the following results and insert them into assigned inputs:
- The number that is most repeated in every sequence.
- The two numbers,in sequence or not, that are most repeated in every sequence.
- The three numbers, in sequence or not, that are most repeated in every sequence.
- The four numbers, in sequence or not, that are most repeated in every sequence.
- The five numbers, in sequence or not, that are most repeated in every sequence.
- The six numbers, insequence or not, that are most repeated in every sequence.
Example:
- 01, 02, 03, 04, 05 (four times each)
- 01-02, 01-03, 01-04, 02-03, 02-04, 03-04 (three times each) ...
FIDDLE: http://jsfiddle.net/v8r6gojz/