Hello,

This problem has arosen in my work and I need help to solve it, because my calculations do not match with the simulation I made in Matlab.

Imagine a generator A of blocks of numbers {0,1,2} separated by spaces {-} with block lenght between m and M. These blocks are received by a box B that process them in this way:

- If the blocks start by 0 and end by 1, the block remains as it was.

- Else, the blocks are trimmed in both ways until it starts by 0 and ends by 1. The trimmed part are substituted by spaces.

- If after the trimming the block is shorter than m, or it's not possible to achieve the structure 0..1, B only sends spaces.

Example: (m=3)

A generates: ----00101011200-, and B transforms into: ----00101011----

A generates: --1112100020102-, and B transforms into: -------000201---

A generates: --1111210122111-, and B transforms into: ---------------- (-01- can be achieved but its length is 2<m)

Question:

P= P(B generates '1' | A generates '1'), (Probability of B generates a '1' conditioned to A has generated a '1')

I think it's better to work with Q = 1-P = 1-P(B generates a space | A generates '1')