Short Strings

## 3064844 - CALCULUS

https://math.stackexchange.com/questions/3064844/

In how many ways can letters in a word CALCULUS be rearranged so that no two identical letters are adjacent?

The answer is

2220

{\displaystyle 2220}

here is an automaton that generates CALCULUS-like words. To cover all possibilities, the S state must and suffice to be reached 5 to 8 times.

For each time, the generating function is

# Z
(
c
a
l
u
s
−

c

2

−

l

2

−

u

2

)

{\displaystyle Z=(c+a+l+u+s-c^{2}-l^{2}-u^{2})}

where $+$ stands for inclusion, and $-$ for exclusion.

Now we take the coefficient of

c

2

a

l

2

u

2

s

{\displaystyle c^{2}al^{2}u^{2}s}

 in

Z

5

Z

6

Z

7

Z

8

{\displaystyle Z^{5}+Z^{6}+Z^{7}+Z^{8}}

 which is

2220

{\displaystyle 2220}

.

The explanation is that each occurence of a double letter in each word is generated twice, once with + and once with -. After summing, the terms containing double consecutive letters vanish.

## 2569399 - RRRGGGBBB

https://math.stackexchange.com/questions/2569399/in-how-many-ways-can-3-red-3-blue-and-3-green-balls-be-arranged-so-that

In how many ways can red, blue, and green balls be arranged so that no two balls of the same colour are consecutive (up to symmetry)?

(
R
G
B
−
R
R
−
G
G
−
B
B
R
R
R
G
G
G
B
B
B

)

3..9

{\displaystyle (R+G+B-RR-GG-BB+RRR+GGG+BBB)^{3..9}}

restricted to

3
,
3
,
3

{\displaystyle 3,3,3}

## 124452 - SLUMGULLION

https://math.stackexchange.com/questions/124452

"How many ways can the letters in the word SLUMGULLION be arranged so that the three L’s precede all the other consonants?"

Here is an automaton that will generate the required words.

A good word has three parts : A is before the third L, then the third L, then the suffix B that contains no L's.

the equations are :

# A
1
(
l
i
o
u
)
.
A

{\displaystyle A=1+(l+i+o+u).A}

# B
1
(
g
m
n
s
i
o
u
)
.
B

{\displaystyle B=1+(g+m+n+s+i+o+u).B}

# W
A
.
l
.
B

{\displaystyle W=A.l.B}

the generating function for W is

1

1
−
(
l
i
o
u
)

.
l
.

1

1
−
(
g
m
n
s
i
o
u
)

{\displaystyle {1 \over 1-(l+i+o+u)}.l.{1 \over 1-(g+m+n+s+i+o+u)}}

and we are interested in the coefficient of

l

3

.
g
.
m
.
n
.
s
.

u

2

.
i
.
o

{\displaystyle l^{3}.g.m.n.s.u^{2}.i.o}

 which is

95040

{\displaystyle 95040}

.

## 2698725 - AABBCCDDEE

 File:2698725c.JPG

https://math.stackexchange.com/questions/2698725/

the-number-of-sequences-of-length-10-that-can-be-formed-with-5-unique-digits seq length 10, 5 double digits]

(

X

1

X

2

.
.
.
−

X

1

X

1

−

X

2

X

2

−
.
.
.

)

5...10

{\displaystyle (X\_{1}+X\_{2}+...-X\_{1}X\_{1}-X\_{2}X\_{2}-...)^{5...10}}

 restricted to

2
,
2
,
2
,
2
,
2

{\displaystyle 2,2,2,2,2}

The number of sequences of length 10 that can be formed with 5 unique digits containing two of each where no two adjacent elements are alike

let T(2n) be the total number of sequences of n digits.

T
(
2
n
# )

(

2
n

2

)

(

2
n
−
2

2

)

.
.
.

(

4
2

)

(

2
2

)

{\displaystyle T(2n)={\binom {2n}{2}}{\binom {2n-2}{2}}...{\binom {4}{2}}{\binom {2}{2}}}

Let

T

1

,

T

2

,

T

3

,
T
4
,

T

5

{\displaystyle T\_{1},T\_{2},T\_{3},T4,T\_{5}}

 be the number of sequences that have at least a bad couple, at least two bad couples, etc.

n

1

=

(

5
1

)

.

1
!

.

(

8
1

1

)

×
T
(
8
)

{\displaystyle n\_{1}={\binom {5}{1}}.\ 1!\ .{\binom {8+1}{1}}\times T(8)}

n

2

=

(

5
2

)

.

2
!

.

(

6
2

2

)

×
T
(
6
)

{\displaystyle n\_{2}={\binom {5}{2}}.\ 2!\ .{\binom {6+2}{2}}\times T(6)}

n

3

=

(

5
3

)

.

3
!

.

(

4
3

3

)

×
T
(
4
)

{\displaystyle n\_{3}={\binom {5}{3}}.\ 3!\ .{\binom {4+3}{3}}\times T(4)}

n

4

=

(

5
4

)

.

4
!

.

(

2
4

4

)

×
T
(
2
)

{\displaystyle n\_{4}={\binom {5}{4}}.\ 4!\ .{\binom {2+4}{4}}\times T(2)}

n

5

=

(

5
5

)

.

5
!

.

(

0
5

5

)

×
T
(
0
)

{\displaystyle n\_{5}={\binom {5}{5}}.\ 5!\ .{\binom {0+5}{5}}\times T(0)}

for example

T

2

{\displaystyle T\_{2}}

 , the case we have at least two bad couples:

(

5
2

)

{\displaystyle {\binom {5}{2}}\ }

 - stands for the choice of the two couples considered

2
!

{\displaystyle 2!\ }

 - the order of the two bad pairs matter

(

6
2

2

)

{\displaystyle {\binom {6+2}{2}}\ }

 - the two couples are separators for the rest of 6 digits (bin bar)

T
(
6
)

{\displaystyle T(6)\ }

 - is just the number of filling the 6 remaining slots

The required number is, by inclusion-exclusion :

T
(
10
)
−

T

1

T

2

−

T

3

T

4

−

T

5

=
39480

{\displaystyle T(10)-T\_{1}+T\_{2}-T\_{3}+T\_{4}-T\_{5}=39480}

## 2955019 - RrGgBb

https://math.stackexchange.com/questions/2955019

A tea set consists of six cups and saucers with two cups and saucers is each of the three different colours. The cups are placed randomly on the saucers. What is the probability that no cups is on a saucer of the same colour?

What we do need here is a painting factory.

The two associated species equation are :

# F
1
(
R
G
B
)
⋅
(
r
g
b
)
⋅
F

{\displaystyle F=1+(R+G+B)\cdot (r+g+b)\cdot F}

 and

# F
1
(
R
r
R
g
B
r
B
g
G
r
G
b
)
⋅
F

{\displaystyle F=1+(Rr+Rg+Br+Bg+Gr+Gb)\cdot F}

The generating function for the first "production line" is:

f
(

x

R

,

x

G

,

x

B

,

x

r

,

x

g

,

x

b

# )

1

1
−
(

x

R

x

G

x

B

)
(

x

r

x

g

x

b

)

{\displaystyle f(x\_{R},x\_{G},x\_{B},x\_{r},x\_{g},x\_{b})={1 \over 1-(x\_{R}+x\_{G}+x\_{B})(x\_{r}+x\_{g}+x\_{b})}}

By Maple, the coefficient of

x

R

2

x

G

2

x

B

2

x

r

2

x

g

2

x

b

2

{\displaystyle x\_{R}^{2}x\_{G}^{2}x\_{B}^{2}x\_{r}^{2}x\_{g}^{2}x\_{b}^{2}}

 is

8100

{\displaystyle 8100}

 and it represents the number of all possible paintings of six china sets under the initial restrictions of color occurences.

The generating function for the second "production line" is:

f
(

x

R

,

x

G

,

x

B

,

x

r

,

x

g

,

x

b

# )

1

1
−
(

x

R

x

r

x

R

x

g

x

B

x

r

x

B

x

g

x

G

x

r

x

G

x

b

)

{\displaystyle f(x\_{R},x\_{G},x\_{B},x\_{r},x\_{g},x\_{b})={1 \over 1-(x\_{R}x\_{r}+x\_{R}x\_{g}+x\_{B}x\_{r}+x\_{B}x\_{g}+x\_{G}x\_{r}+x\_{G}x\_{b})}}

By taking into account the second coefficient we obtain:

# P

900
8100

=

1
9

{\displaystyle P={900 \over 8100}={1 \over 9}}