Primitive bit strings

A primitive string is not expressible as a concatenation of several identical smaller strings, for instance 110110 is not primitive, but 1011 is.

How many bit strings of length 12 are primitive?


The answer is 4020.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Jackson Abascal
Feb 7, 2015

In order for a bit string to repeatedly concatenate to another string of length n, the length of the string must be a proper divisor of n. We can develop a recurrence relation for the number of primitive strings: F ( n ) = 2 n F ( d ) F(n)={ 2 }^{ n }-\sum { F(d) } for each proper divisor d of n. Calculating only the values we need we get F ( 1 ) = 2 1 F ( 2 ) = 2 2 F ( 1 ) = 2 F ( 3 ) = 2 3 F ( 2 ) F ( 1 ) = 6 F ( 4 ) = 2 4 F ( 2 ) F ( 1 ) = 12 F ( 6 ) = 2 6 F ( 3 ) F ( 2 ) F ( 1 ) = 54 F ( 12 ) = 2 12 F ( 6 ) F ( 4 ) F ( 3 ) F ( 2 ) F ( 1 ) = 4020 F(1)={2}^{1}\\ F(2)={ 2 }^{ 2 }-F(1)=2\\ F(3)={ 2 }^{ 3 }-F(2)-F(1)=6\\ F(4)={ 2 }^{ 4 }-F(2)-F(1)=12\\ F(6)={ 2 }^{ 6 }-F(3)-F(2)-F(1)=54\\ F(12)={ 2 }^{ 12 }-F(6)-F(4)-F(3)-F(2)-F(1)=\boxed { 4020 }

Ivan Koswara
Feb 8, 2015

Let's compute the number of non-primitive strings first.

There are 2 6 2^6 strings which can be divided into two equal parts, such as 101100101100, 100100100100, 010101010101, and 111111111111.

There are 2 4 2^4 more strings which can be divided into three equal parts, such as 110011001100, 101110111011, 010101010101, and 111111111111.

However, 2 2 2^2 of these strings actually count the same strings, those that can be divided into six equal parts, such as 010101010101 and 111111111111 above.

Thus, by Principle of Inclusion-Exclusion, there are 2 6 + 2 4 2 2 = 76 2^6 + 2^4 - 2^2 = 76 non-primitive strings. None of the remaining strings can be non-primitive, since the length of the string is 12 12 and the number of parts must thus be a divisor of 12 12 , which thus must have either 2 2 or 3 3 as a prime factor and thus is counted above.

There are 2 12 2^{12} bit strings in total. Thus, by complementary counting, there are 2 12 76 = 4020 2^{12} - 76 = \boxed{4020} primitive strings.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...