Discrete-Continuous Sequences

Let a finite sequence of values be called discrete-continuous if the following conditions hold:

  • Each value is 0, 1, or -1.
  • The absolute value of the difference between any two consecutive terms is at most 1.

Thus, while 0, 1, 1, 0, -1 is discrete-continuous, 0, 1, -1, 0, 1 is not. Find the number of discrete-continuous sequences of length 7.


The answer is 577.

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

Arjen Vreugdenhil
Dec 21, 2017

We solve the problem for sequences of length n n .

First, add a zero to the front and to the end of the sequence. Now write between each pair of successive digits whether they remain the same ( = \mathbf = ) or are different ( \mathbf \star ). Thus, ( 1 , 0 , 0 , 1 , 1 , 0 , 1 ) ( 0 1 0 = 0 1 = 1 0 1 0 ) . (-1,0,0,1,1,0,1) \mapsto (0\ \mathbf \star\ {-1}\ \mathbf \star\ 0\ \mathbf =\ 0\ \mathbf \star\ 1\ \mathbf =\ 1\ \mathbf \star\ 0\ \mathbf \star\ 1\ \mathbf \star\ 0). It is easy to check that we have n + 1 n + 1 symbols; and that the number of stars is even.

Consider the sequences with 2 k 2k stars (and n + 1 2 k n + 1 - 2k equal signs). There are ( n + 1 2 k ) \binom{n+1}{2k} ways to place the star. Every other star represents a jump from zero to either + 1 +1 or 1 -1 . There are 2 k 2^k ways to choose these signs. Thus there will be 2 k ( n + 1 2 k ) 2^k\binom{n+1}{2k} sequences with 2 k 2k stars.

The total number of sequences is therefore S ( n ) = k = 0 ( n + 1 ) / 2 2 k ( n + 1 2 k ) . S(n) = \sum_{k=0}^{\lfloor (n+1)/2\rfloor} 2^k\binom{n+1}{2k}.

It is not difficult to see, using the binomial theorem, that this may be written as S ( n ) = ( 1 + 2 ) n + 1 + ( 1 2 ) n + 1 2 = [ 1 2 ( 1 + 2 ) n + 1 ] . S(n) = \frac{(1+\sqrt 2)^{n+1} + (1-\sqrt 2)^{n+1}}2 = [\tfrac12(1 + \sqrt 2)^{n+1}]. (Here, [ ] [\cdot] stands for rounding to the nearest integer.)


For n = 7 n = 7 , we find S ( n ) = ( 8 0 ) + 2 ( 8 2 ) + 4 ( 8 4 ) + 8 ( 8 6 ) + 16 ( 8 8 ) = 1 + 56 + 280 + 224 + 16 = 577 ; S(n) = \binom 8 0 + 2\cdot\binom 8 2 + 4\binom 8 4 + 8\cdot\binom 8 6 + 16\cdot\binom 8 8 = 1 + 56 + 280 + 224 + 16 = 577; or S ( n ) = [ 1 2 ( 1 + 2 ) 8 ] = [ 576.99957 ] = 577 . S(n) = [\tfrac12(1 + \sqrt 2)^8] = [576.99957] = \boxed{577}.


Recursive solution

Let S ( n ) S(n) be the number of sequences of length n n and S x ( n ) S_x(n) the number of these sequences ending in x x . Then S 0 ( n ) + S 1 ( n ) + S + 1 ( n ) = 0 ; S 1 ( n ) = S + 1 ( n ) . S_0(n) + S_{-1}(n) + S_{+1}(n) = 0;\ \ \ S_{-1}(n) = S_{+1}(n). We make a sequence of length n n by adding a digit to a sequence of length n 1 n-1 :

  • if the original sequence ends in zero, we may any digit we wish (three possibilities); otherwise, there are only two valid choices: S ( n ) = 3 S 0 ( n 1 ) + 2 ( S 1 ( n 1 ) + S + 1 ( n 1 ) ) = S 0 ( n 1 ) + 2 S ( n 1 ) ; S(n) = 3S_0(n-1) + 2(S_{-1}(n-1) + S_{+1}(n-1)) = S_0(n-1) + 2S(n-1);
  • to make a sequence ending in zero, we may start with any shorter sequence: S 0 ( n ) = S ( n 1 ) S_0(n) = S(n-1) .

Combining this, we see that S ( n ) = S 0 ( n 1 ) + 2 S ( n 1 ) = 2 S ( n 1 ) + S ( n 2 ) . S(n) = S_0(n-1) + 2S(n-1) = 2S(n-1) + S(n-2). To solve this recursion equation, we try S ( n ) = α p n S(n) = \alpha p^n and obtain p 2 2 p 1 = 0 p^2 - 2p - 1 = 0 . The solutions are p = 1 ± 2 p = 1 \pm \sqrt 2 ; thus we set S ( n ) = α ( 1 + 2 ) n + β ( 1 2 ) n , S(n) = \alpha(1 + \sqrt 2)^n + \beta(1 - \sqrt 2)^n, and with S ( 0 ) = 1 S(0) = 1 , S ( 1 ) = 3 S(1) = 3 we easily find α = β = 1 2 \alpha = \beta = \tfrac12 .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...