SHAIK AASIF AHAMED
Last Activity: 10 Years ago
Hello student,
Please find the answer to your question below
If a sequence has an even number of zeros and an even number of ones, it has an even number of zero/ones. So instead of considering sequences with at least one zero/one, consider sequences with a positive even number of zero/ones.
The number of sequences with an even number of zero/ones is4n/2- this can be proved by considering the possibilities for the last digit. The number of sequences with a positive even number of zero/ones is therefore (4n/2)−2n. By the same "flipping" argument as above, half of these sequences, (4n/4)−(2n/2), have an even number of zeros. Adding the sequences with no zeros or ones we get4n/4+2n/2.
For example let us take on integers {0,1,2,3} on even number of zeros
Let an denote the number of n-digit sequences containing an even number of
0′s. Then there are an-1(n ─ 1)-digit sequences that have an even number of 0′s
and 4n-1 ─ an-1 (n ─1)-digit sequences that have an odd number of 0′s. To each
of the an-1 sequences that have an even number of 0′s, the digit 1,2 or 3 can be
appended to yield sequences of length n that contain an even number of 0′s. To
each of the 4n-1 ─ an-1 sequences that have an odd number of 0′s, the digit 0 must
be appended to yield sequences of length n that contain an even number of 0′s.
Therefore, for n ≥ 2, an = 3an-1 + 4n-1─ an-1 = 2an-1 + 4n-1, with a1 = 3.