You are on page 1of 7

256

Sequences with Adjacent ElementsUnequal


L. Q. EIFLER,K. B. REID, JR.1), and D. P. ROSELLE~) (Baton Rouge, Louisiana, U.S.A.)

1. Introduction

Several papers on a combinatorial problem posed by Smirnov have appeared


recently. This problem gives k classes of objects with s~ identical objects in the/-th
class and asks for the number, M(sl, ..., sk), of sequences of length s~ + ... +sk which
consist of these objects and in which no two objects from the same class are adjacent.
Asymptotic formulas are given in [5] and [6], applications are mentioned and a
table of values of M(sl, s2, sa) computed in [1], and the recurrence
k si

M(Sl ..... Sk) = Z Z (-- l ) J + l M ( S l , ' " ' s i - l ' si--J' si+! ..... st)' (1.1)
i=1 j=l
where M(s~ ..... s~_l, O, si+~, ..., sk)=M(st, ..., s,_~, s,+~, ..., Sk) is proved in [2] and
[3]. The latter also mentions the circular version of the problem.
Here we derive recurrences satisfied by and an explicit expression for M ( s t ..... Sk).
We also give a combinatorial argument in order to derive a simple explicit expression
for M(s, s, s). Finally, we give a solution for the circular version of the problem.

2. Three Classes of Elements

We begin by considering the case o f three classes of elements, say l's, 2's and 3's,
and an equal number of elements in each class. The sequences made up of these objects
can be divided into those which start and end with a 1 and those which start but do
not end with a 1. If there are A (s) of the first kind and B(s) of the second kind, then
it is immediate that
M(s, s, s) = 3A (s) + 3B(s). (2.1)
Hence it will suffice to determine A (s) and B(s). Notice that ifc~ denotes a sequence
counted by A (s), then c consists of s - l non-void blocks of 2's and 3's with each
block preceded and followed by a 1. If t denotes the number of these blocks which
contain an odd number of elements, then it follows that t is even, say t = 2v. Thus there
are arrangements for the odd blocks. Fix such an arrangement and note that,

since the number of 2's and 3's being distributed are equal, exactly v of the odd blocks

1) Supported in part by National Science Foundation grant GP19691.


2) Supported in part by National Science Foundation grant GP19207.

Received September 24, 1970


Sequences with Adjacent Elements Unequal 257

begin with a 2 and exactly v begin with a 3. Choose the v odd blocks which are to
begin with a 2 and place a 3 as the beginning element in the v remaining odd blocks.
This choice can be made in (2v) ways.

In order to construct all of the sequences counted by A (s), it is now only necessary
to place 2,3 or 3,2 doubletons in the s - 1 blocks between consecutive l's with the
condition that the s - 1 - 2 v even blocks must contain at least one doubleton. If we
begin by making 2 s- ~-2v choices for assigning one doubleton to each even block, then
it remains only to assign the s-(v+s-1-2v)=v+ 1 remaining doubletons to the
s - 1 partially constructed blocks. There are [4, p. 92]

ways to make this final assignment.


Combining these remarks, we find that

A(s)= ~ ( s - 1 ) (2:) (s +v +vl- 1 ) (2.2)


v=0

Also, only a slight modification of this argument is necessary to show that

v=O

We summarize the results of this section as

T H E O R E M 1. Let M(s) denote the number of sequences comprisedof s of each of


three distinct classesof objects and with no two objectsfrom the sameclassadjacent. Then
M (s) = 3 { ~ (s -1) ( ~ ) (s +v+v -11 ) 2~-l-
v=O
(2.4)
+ ~ (2;)(2W)(s +;--1)2,_2v}.
v=0

3. The General Case

It will be convenient to allow M, (sl,..., sk) to denote the number of sequences of


the desired type in which there are r classes which consist of a single object and k
additional classes, the i-th of which contains st objects. That is, M~(s~,..., sk)=
M(il, ..., ik+,), where ij= 1 (1 <~j<~r)and i,+j=sj(1 <~j<~k). Using this notation, we
258 L.Q. Eifler, K.B. Reid, Jr. and D. P. Roselle A~Q. MATH.

are able to state the identity

M , ( s l ..... Sk) = r! M ( j , sl, ..., sk). (3.1)


j=l

To prove (3.1), we first write it in the form


r-1
1
M ( r , sl,..., sk) = r! M , ( s l ..... s k ) - ) i ( ~ - ~) M ( j , Sl,..., Sk). (3.2)
j=l

The first term in the right member of (3.2) counts those sequences in which the r objects
of the first class are considered distinct, but identifies those sequences which only differ
by permutations of these r objects. In order to construct the sequences counted by
M ( r , s 1..... Sk), it is necessary to delete those sequences in which one or more of the
r objects of the first class are adjacent. To do this, we first choose j on the range
1 <<,j<~r- 1 and form the M ( j , sl, ..., Sk) sequences in which the objects of the first
class are thought of as 'blanks'. We then wish to assign the r objects of the first class
to these j blanks in such a way that each blank is assigned at least one object. Since
these assignments are in one to one correspondence with the number of compositions
C')
o f r i n t o j non zero parts [4; p. 92], they are j _ 1 in number. It is easy to verify that
each sequence in which objects from the first class are adjacent is obtained exactly
one time in this manner. Summing over j, we obtain the second term in the right
member of (3.2).
It follows from (3.1) and binomial inversion that

M ( r , s 1.... , Sk) = (-- 1) ' - J -- ~Mj(s, ..... Sk). (3.3)


j=l

The effect of (3.3) is to reduce the computation of M ( r , sl . . . . , Sk) to that of


M , ( s l . . . . , sk).
Our next identity is the recurrence

sM, (s, s2 ..... Sk) = M,+I (s - 1, s2,..., Sk) } (3.4)


- 2 ( s -- 1) M , ( s - - 1, s2 ..... Sk) -- (S - - 2) M , ( s -- 2, s2, ..., Sk).

The p r o o f of (3.4) is similar to that o f (3.3). First, we distinguish one of the s


elements of the first class, say x. Next we form the M,+I ( s - 1, sz, ..., sk) sequences
in which x is treated as comprising a single class. Notice that we can obtain the se-
quences counted by the left member of (3.4) by deleting the sequences where x appears
adjacent to either one or two of the objects of the first class. The first o f these is
Wol. 6, 1971 Sequences with Adjacent Elements Unequal 259

obtained by inserting x on either side of the s - 1 objects of the first class in each of the
sequences counted by M, ( s - 1, s 2.... , Sk). If 1 is an object of the first class, then the
second type of sequence to be deleted is obtained by inserting the pair x, 1 immediately
after each occurrence of 1 in each of the sequences counted by Mr ( s - 2, s2 .... , Sk).
This evidently completes the proof of (3.4).
Using (3.4) and induction on s, we find that we can write
s--1
M~(s, s2 ..... sk) = E ( - 1)J'aJ(s) M,+~-i(s2 ..... sk). (3.5)
j=O

Indeed, using (3.4), we see that ~j(s) satisfies the recurrence

s~j(s)=~j(s-1)+2(s-1)~j_l(s-1)-(s-2)~j_2(s-2 ). (3.6)

In order to solve this recurrence, we write/3j (s)= s0q_j (s)(1 ~<j~<s) and note that
(3.6) can be rewritten as

~j(s) = ~ , _ j ( s - 1) + 2/~j(s- 1 ) - / 3 j ( s - 2).

Substracting/~j ( s - 1) from both sides of this equation and adding over s, we obtain

/3i ( n ) = ~ a ~ _ j ( s - 1 ) + f l j ( n - 1 ) .
s=j

Again if we substract/3j ( n - 1) from both sides and add, we find that

rn~,,_j(m)=flj(m)= ~ ~" o t , _ j ( s - 1 ) - - ~ (m+l--s)~_j(s-1).


n = j s=y s=j

It is now easy to establish that

j .

Of course this can be proved directly from (3.6) by induction on s.


Combining the remarks of the last paragraph, we find that

1
M,(s, s2 ..... sk) = ,-, ( - 1 ) ~ - / j i M,+,(s2 ..... sk). (3.8)
j=l

Notice that (3.8) is valid for r = 0 since, in this case, it reduces to (3.3).
It is easy to verify that
M,(s) = ( r + l ) r !. (3.9)
S
260 L . Q . Eifler, K . B . R e i d , Jr. a n d D . P. R o s e l l e AEQ. MATH.

Hence if we iterate (3.8), then we obtain


k- 1 sl
Mr(sl, " " , Sk) = Z Z ( - - 1) s a + ' ' ' + s k - ~ - j t - .... Jk-t
i=1 ji=l
(3.1o)

In particular for r = 0, we obtain

T H E O R E M 2. Given k classes of elements with s t identical objects in the i-th class,


the number of sequences o f length sl + "'" + sk which consist of these elements and in
which no two objects from the same class are adjacent is given by
k - 1 st
M ( , ~ ..... s~) = X Z (- 1) ~ ' + + s ~ - ' - : ' - .... ~-'
i=1 jt=l

17
,=1 ! J* -- sk

In addition to (3.4), two other recurrences have been useful for computing
Mr (sl, ..., sk). The first is

k
+ X ( s , - 1 ) Mr_~(s~ ..... s , _ ~ , , ~ - 1,~,+, ..... s~).
i=1

The p r o o f of this recurrence is similar to that given for (3.4). The second recurrence
follows by combining this latest recurrence with (4.3). It is

(s, + ~) m , ( s l + 1, ~2 ..... s~) = (r - ~, + s2 + . . . + s,, + ~) M r ( s , ..... ~,,)


k
+ Z (s, - 1) M,(s~ ..... s,_~, ~ - 1, s,+, ..... ~,,).
i=2

4. N e c k l a c e s

We next consider the problem o f determining the number, N (n), of non-equivalent


necklaces in which no two beads of the same color are adjacent. Of course, two
necklaces are equivalent if there is a rotation which brings them into coincidence. For
convenience, we will limit our consideration to the case of three colors and an equal
number of beads of each color. However, the argument is easily extended to cover the
general case.
Vol. 6, 1971 Sequences with Adjacent Elements Unequal 261

Recalling the notation of 2, we let B (n) denote the number of sequences of length
3n which consist of n objects from each of three classes, in which objects from the
same class are not adjacent, and which begin with an object from the first class and
end with an object from a different class. With each necklace, we associate a unique
minimum period d and note that d has the properties that d ] 3n and 3 [ d. Since each
necklace of period d corresponds to d different linear sequences, we find that if P (d)
denotes the number of necklaces of length d and period d, then

E dP(d)=3BO)
dl 3n
31a
or, if we prefer,
3B(n) = Y, 3se(3s).
5s=n
This is the same as
B(n) = Z sP(3s) (4.1)
s]n

and, applying M6dius inversion, we find that

P(3n) = 1~ /~ (6) B (d). (4.2)


n
d6=n

Of course, the total number of necklaces of the desired type is given by

N(n) = E e(3d). (4.3)


din

5. Computation

The following table gives A (s), B(s), M(s), P(3s), and N(s) for I ~<s~< 10.

Table
s A(s) B(s) M(s) P(3s) N(s)

1 0 2 6 2 2
2 2 8 30 3 5
3 14 44 174 14 16
4 96 268 1092 65 70
5 664 1732 7188 346 348
6 4660 11624 48852 1929 1948
7 33144 80096 339720 11442 11444
8 238448 562748 2403588 70310 70380
9 1732112 4013396 17236524 445928 445944
10 12685428 28964128 124948668 2896239 2897981
262 L.Q. Eifler, K.B. Reid, Jr. and D. P. Roselle

REFERENCES

[1] ALTER,R. and LiErrrz, B. P., Applications ofa Generalized Problem of Smirnov, Naval Res. Logist.
Quart. 16, 543-547 (1969).
[2] ALTER,R. and LIENTZ,B. P., A Generalization of a Combinatorial Problem of Smirnov, System
Development Corporation Document, SP 3254.
[3] ALTER,R. andLmNTZ, B. P., OnaGeneralizedProblemofSmirnov, (to appear).
[4] PdORDAN,J., An lntroductfon to Combinatorial Analysis (John Wiley & Sons, New York, N.Y. ;
Chapman & Hall, London [Wiley Publ. in Math. Statistics]).
[5] SARMANOV,O.B. and ZAHAROV,V. K., A Combinatorial Problem of N. 11". Smirnov (Russian),
Dokl. Akad. Nauk SSSR 176, 530-532 (1967) [English Translation: Soviet Math. Dokl. 8,
1147-1150 (1967)].
[6] Sr~m~Nov,N. V., S~MANOV, O. V., and ZA~AROV,V. K., A Local Limit Theorem for the Number
of Transitions in a Markov Chain and Its Applications (Russian), Do/~!. Akad. Nauk. SSSR 167,
1238-1241 (1966) [English Translation: Soviet Math. Dokl. 7, 563-566].

Louisiana State University, Baton Rouge

You might also like