Count of binary numbers after excluding specific bits

55 Views Asked by At

The subset of binary numbers are limited to n bits. A bit group is a pair of two bits with their specific values. There are multiple bit groups. Each bit group excludes the pair of bits, which means that any number that contains those bits is not added in the final count.

Example:

n=3
000, 001, 010, 011, 100, 101, 110, 111

Exclude group A = x10 (note: x means that the bit is not part of the group)
000, 001, 010, 011, 100, 101, 110, 111

Exclude group B = 1x0
000, 001, 010, 011, 100, 101, 110, 111

Exclude group C = 1x1
000, 001, 010, 011, 100, 101, 110, 111

The final count of binary numbers is 3.
000, 001, 010, 011, 100, 101, 110, 111

Is it possible to calculate the exact number of binary numbers for arbitrary input, or otherwise to determine if there is at least one binary number that satisfies the requirements?