M
M
Maxim Barulin2012-03-14 15:13:12
Programming
Maxim Barulin, 2012-03-14 15:13:12

Calculation of the number of sequences

Good day, Habr!
There are four sets of numbers from 1 to 10, you need to count the number of possible occurrences of the sequence from any 5 elements of the sets, while the sequence can include elements from any set, the main thing is that they go in a row, for example:

set 1: 1,2,3,4 ,5,6,7,8,9,10
set 2: 1,2,3,4,5,6,7,8,9,10
set 3: 1,2,3,4,5,6,7 ,8,9,10
set 4: 1,2,3,4,5,6,7,8,9,10

sequence can be 1,2,3,4,5 or 5,6,7,8,9 or 2,3,4,5,6 etc. the main thing is that the elements go in a row; they can contain numbers from any of the 4 sets. It is necessary to calculate how many such sequences can be in these 4 sets.

Logic suggests that you need to use combinatorics formulas, in particular 10!/(5!*(10-5)!), but in this way the number of sequences in one set is calculated, I don’t understand how to take into account that the numbers in it can be from any set

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Riateche, 2012-03-14
@Riateche

You have only 6 options for sequences of numbers: 1,2,3,4,5; 2,3,4,5,6;…; 6,7,8,9,10. In one of these sequences, you need to independently choose for each of the 5 digits from which set we will take it. This can be done in 4^5 ways. Total 6 * 4^5.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question