Ones Stick Together

Let P : N N P : \mathbb{N} \rightarrow \mathbb{N} be the counting function such that P ( n ) P(n) denote the number of ways of making unique strings of 1's and 0's of length n n such that any "1" in this string is next to another.

Eg P ( 4 ) = 7 P( 4 ) = 7 since the only valid ways of making the valid strings of length 4 are

0000 0011 0110 0111 1100 1110 1111 \begin{aligned} &0000 \\ &0011 \\ &0110 \\ &0111 \\ &1100 \\ &1110 \\ &1111 \\ \end{aligned}

Which of the following recursions relationships are true for all n 4 n \ge 4 ?

Notation : N \mathbb N denotes the set of natural numbers .

P ( n ) = 2 P ( n 1 ) P(n) = 2 P ( n - 1 ) P ( n ) = P ( n 1 ) + n 1 P( n ) = P( n -1 ) +n - 1 P ( n ) = 2 P ( n 1 ) P ( n 2 ) + P ( n 3 ) P(n) = 2P(n-1) - P(n-2)+P(n-3) P ( n ) = P ( n 1 ) + P ( n 2 ) + 1 P( n ) = P( n - 1 ) + P( n - 2 ) + 1

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.

1 solution

Here's a quick, intuitive solution!

P ( n ) = The number of ways of making unique strings of 1s and 0s of length n such that any 1 in this string is next to another. P( n ) = \text{ The number of ways of making unique strings of 1s and 0s of length n such that any 1 in this string is next to another. } = The number of ways that end in 0 1s + The number of ways that end in 2 1s + The number of ways that end in more than 2 1s. = \text{ The number of ways that end in 0 1s + The number of ways that end in 2 1s + The number of ways that end in more than 2 1s. }

But The number of ways that end in 0 1s \text{ The number of ways that end in 0 1s } is all the valid strings that end in a 0 0 . The amount that satisfy this is P ( n 1 ) P(n-1) since if we remove the 0 0 on the end, the other n 1 n-1 must satisfy the conditions of P ( n 1 ) P(n-1) .

Similarly we have The number of ways that end in 2 1s \text{ The number of ways that end in 2 1s } is just all the valid strings that end in 011 011 . This is just P ( n 3 ) P(n-3) since if we take away the zero on the end, the other n 3 n-3 must satisfy the conditions of P ( n 3 ) P(n-3) .

Finally for The number of ways that end in more than 2 1s \text{ The number of ways that end in more than 2 1s } , all of these end in a 1 1 . What happens if we remove that final 1 1 ? We must still have some new string that ends in atleast 2 2 1 1 s. So this is all the the strings of P(n-1) that end in a 1. How many have this property? It's P ( n 1 ) P ( n 2 ) P(n-1) - P(n-2) , can you see why?

Finally, adding all of this together gives our desired relation that's valid for all n 4 n \ge 4 .


Bonus Questions

  • Can you see another way to derive the correct answer?

  • Can you find a closed form formula for n n ?

  • Can you find any other reccurrence relations for this function?

  • What happens if we change it so we have to have any 1s have to part of 3 in a row instead of 2?

  • What happens if we add more numbers we are allowed to use with similar restrictions?

  • Can you find any cool generating functions for this function?

I'm pretty sure that answer 3 which is P(n-1)+n-1 is also a valid answer. And here is why: if you take the list of all strings that are part of P(n-1) and add 0 to the front of them then they are part of P(n). Now, what strings are we left with in P(n)? They are the strings that ends with 1, because we counted all the strings thst ends with 0. These are the strings that ends with 2 1's, 3 1's, 4 1's, etc until n 1's. And how many of those do we have? Exactly n-1. Therefore the number of strings in P(n) is P(n-1) + n -1

Yaniv Nimni - 4 years, 10 months ago

Log in to reply

Hi Yaniv, Awesome idea! I'm not sure if it's right or not so let's try figure it out. Why do you think its exactly n - 1 for the amount that end in a 1? This doesn't seem obvious to me?

I make P(6) out to be 21 which doesn't seem to follow your suggested formula since we'd get P(6) = P(5)+5 = P(4)+4+5 = 7+4+5 = 16.

So I don't think is true for all n >=4 .

Roberto Nicolaides - 4 years, 10 months ago

Log in to reply

Ok, i see where i had my mistake. I did not account for more than one substring of 1's. For instance 11011 is part of P(5), yet i did not take it into consideration in my counting.

Yaniv Nimni - 4 years, 10 months ago

I would say that the answer is P(n) = P(n -1) + P(n -2) + 1 ,If I'm not wrong : P(1)=1

p(2) = 2

p(3) = 4

p(4) = 7

p(5) = 12

p(6) = 20

Guillermo Templado - 4 years, 10 months ago

Log in to reply

Hey Guillermo, I made p(6) out to be 21 last time I tried. Let me know if you think I've made a mistake :)

Roberto Nicolaides - 4 years, 10 months ago

Log in to reply

yes, I'm wrong, sorry.

Guillermo Templado - 4 years, 10 months ago

This question is fairly similar to AMO 2016 Q4. I used a similar recursive argument to solve it.

Sharky Kesa - 4 years, 10 months ago

Log in to reply

Sounds cool, can you send a link?

Roberto Nicolaides - 4 years, 10 months ago

Log in to reply

Here it is .

Sharky Kesa - 4 years, 10 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...