Imagine you have an array of integer numbers. You need to calculate the probability of encountering some integer sub-array in that list.
For example:
the original list: '1284726437594563495834905834095845634853' which is N integers from 0 to 9.
the question is: what is the probability to encounter '456', order is significant, in that big data set?
my considerations: The are N-2 possible sets of 3 numbers in big list. Each has (1/10)^3 variants. With order significant we need one of them, but any place of the pattern would match. So we have
(1/10)^3 * (N-2)
In case order is not significant, there are n! possible permutations for n items. Thus the formula is
(1/10)^3 * 3! * (N-2)
Am I right?
UPDATE: The digits are distributed randomly, i.e. a possibilities of them are equal. The list is some sequence of these random digits. By "encounter" I mean to have at least one '456' sequence in the given data set.
Looks like my considerations were wrong. Here is a corrected version: A probability to meet at least one sub-array '456': A probability not to meet any is (1 - (1/10)^3) ^ (N-2), so probability to meet one is
1 - (1 - (1/10)^3) ^ (N-2)
A most probable number of patterns to meet is
(N-2) * 1/10^3