Sandbox

https://oeis.org/A005251

# i
0

∞

2

−
i

{\textstyle \sum\_{i=0}^\infty 2^{-i}}

∑

# i
0

∞

2

−
i

{\displaystyle \sum\_{i=0}^\infty 2^{-i}}

## test

(

2
M

)

{\displaystyle {2 \choose M}}

(

(

n
k

)

!

)

{\displaystyle \left( \! \tbinom{n}{k} ! \right) }

{

x

y

z

v

}

{\displaystyle \begin{Bmatrix} x & y \\ z & v
\end{Bmatrix}}

## avoiding 00, 11, 111 =

Here is a rewriting of above work using automaton and generating functions. The associated grammars need to be unambiguous; if not, because of the copies, the numbers obtained will be higher than the right ones.

By the second diagram, one may write

# A
x
x
C
x
D

{\displaystyle A = x + xC + xD}

 where :

# A

a
1

x

a
2

x
2

a
3

x
3

.
.
.

{\displaystyle A = a\_1x + a\_2x^2 + a\_3x^3 + ... }

 is the generating function (or the string index) for words that ends exactly in 0. The same for B, C, D.

Similarly, the other three equations are:

# B

x
3

x
B

x
3

C

x
3

D

{\displaystyle B = x^3 + xB + x^3C + x^3D }

# C
x
x
A
x
B

{\displaystyle C = x + xA + xB}

# D

x
4

x
4

A

x
4

B
x
D

{\displaystyle D = x^4 + x^4A + x^4B + xD}

x
3

{\displaystyle x^3}

 covers the bit string 000;

x
4

{\displaystyle x^4}

 covers the bit string 1111;

This system easily solves to the same solution as the first diagram :

here (for example),

x

x
3

1
−
x

{\displaystyle x + {x^3 \over 1-x } }

encodes the set { 0, 000, 0000, 00000, ....}

the two equations are

A
# B

x
−

x
2

x
3

1
−
x

(
C
D
1
)

{\displaystyle A+B = {x-x^2+x^3 \over 1-x } ( C + D + 1 ) }

and

C
# D

x
−

x
2

x
4

1
−
x

(
A
B
1
)

{\displaystyle C+D = {x-x^2+x^4 \over 1-x } ( A + B + 1 )}

that easily solves to

# W
A
B
C
# D

2
x
−
2

x
2

−

x
3

4

x
4

−

x
5

−
2

x
6

2

x
7

1
−
2
x
2

x
3

−
2

x
4

x
6

−

x
7

{\displaystyle W=A+B+C+D= {2x - 2x^2 - x^3 + 4x^4 -x^5 -2x^6 + 2x^7 \over 1 - 2x + 2x^3 - 2x^4 + x^6 - x^7} }

=
2
2
x
3

x
2

6

x
3

11

x
4

18

x
5

30

x
6

50

x
7

85

x
8

143

x
9

241

x

10

.
.
.

{\displaystyle = 2+2x +3x^2 +6x^3 +11x^4 +18x^5+30x^6 +50x^7 +85x^8 +143x^9+ 241x^{10} + ...}

The denominator encodes the required recurrence.

# A
y
A
y
C
1

# B
x
A
1

# C
y
B
y
D
1

# D
x
B
x
D
1

{\displaystyle \begin{cases}
A = yA+yC+1\\
B= xA+1 \\
C = yB+yD+1\\
D = xB+xD+1
\end{cases}}

A
B
C
# D
y
(
A
B
C
D
)
x
(
A
B
D
)
4

{\displaystyle A+B+C+D = y(A+B+C+D) + x(A+B+D) + 4 }

A
B
# D
(
y
A
x
B
y
C
x
D
)
x
A
3

{\displaystyle A+B+D = (yA + xB+ yC + xD) + xA + 3 }

y
A
x
B
y
C
x
# D

{\displaystyle yA + xB + yC + xD = }

y
(
y
A
y
C
1
)
x
(
x
A
1
)
y
(
y
B
y
D
1
)
x
(
x
B
x
D
1
# )

{\displaystyle y(yA+yC+1) + x(xA+1 ) + y(yB+yD+1) + x (xB+xD + 1) = }

(

y
2

x
2

)
A
(

y
2

x
2

)
B

y
2

C
(

y
2

x
2

)
D
(

x
3

x
2

y
x

y
2

y
3

# )

{\displaystyle (y^2+x^2)A + (y^2+x^2)B + y^2C + (y^2 + x^2)D + (x^3 + x^2y + x y^2 + y^3 ) = }

y
2

(
A
B
C
D
)

x
2

(
A
B
D
)
2
x
2
y
# )

{\displaystyle y^2(A+B+C+D) + x^2 (A+B+D) + 2x+2y) = }

# A
y
A
y
C
# 1
y
(
y
A
y
C
1
)
y
(
y
B
y
D
1
)
# 1

{\displaystyle A = yA+yC + 1 = y(yA+yC + 1) + y( yB+yD+ 1) + 1 = }

y
2

(
A
B
C
D
)
1
2
y

{\displaystyle y^2(A+B+C+D) + 1+2y }

{

# E
y
E
x
F
4

# F

y
2

E

x
2

F
x
A
3
2
x
2
y

# A

y
2

E
1
2
y

{\displaystyle \begin{cases}
E = yE + xF + 4 \\
F= y^2E+x^2F + xA + 3 + 2x + 2y \\
A = y^2E + 1 + 2y
\end{cases}}

{

# E
y
E
x
F
4

# F

y
2

E

x
2

F
x

y
2

E
x
(
1
2
y
)
3
2
x
2
y

{\displaystyle \begin{cases}
E = yE + xF + 4 \\
F= y^2E+x^2F +xy^2E + x(1 + 2y) + 3 + 2x + 2y
\end{cases}}

F
(
1
−

x
2

# )
(

y
2

x

y
2

)
E
3
3
x
2
y
2
x
y

{\displaystyle F(1-x^2) = (y^2+xy^2) E + 3 + 3x + 2y + 2xy }

# E
y
E

x
(

y
2

x

y
2

)
E
x
.
p
o
l
y
n
o
m
i
a
l

(
1
−

x
2

)

4

{\displaystyle E = yE + \frac {x(y^2+xy^2)E + x.polynomial} {(1-x^2) } + 4 }

(
1
−

x
2

)
# E
(
1
−

x
2

)
y
E
x
(

y
2

x

y
2

)
E
x
.
p
o
l
y
n
o
m
i
a
l
(
1
−

x
2

)
4

{\displaystyle (1-x^2)E = (1-x^2)yE + x(y^2+xy^2)E + x.polynomial+ (1-x^2)4 }

# A
y
A
y
C

y
2

# B
x
A
x
y

# C
y
B
y
D
x
y

# D
x
B
x
D

x
2

{\displaystyle \begin{cases}
A = yA+yC+y^2\\
B= xA+xy \\
C = yB+yD+xy \\
D = xB+xD+x^2
\end{cases}}

A
B
C
# D
y
(
A
B
C
D
)
x
(
A
B
D
)
(
x
y

)
2

{\displaystyle A+B+C+D = y(A+B+C+D) + x(A+B+D) + (x+y)^2}

A
B
# D
(
y
A
x
B
y
C
x
D
)
x
A
(

y
2

x
y

x
2

)

{\displaystyle A+B+D = (yA + xB+ yC + xD) + xA + (y^2 + xy + x^2)}

y
A
x
B
y
C
x
# D

{\displaystyle yA + xB + yC + xD = }

y
(
y
A
y
C

y
2

)
x
(
x
A
x
y
)
y
(
y
B
y
D
x
y
)
x
(
x
B
x
D

x
2

# )

{\displaystyle y(yA+yC+y^2) + x(xA+xy ) + y(yB+yD+xy ) + x (xB+xD+x^2) = }

(

y
2

x
2

)
A
(

y
2

x
2

)
B

y
2

C
(

y
2

x
2

)
D
(

x
3

x
2

y
x

y
2

y
3

# )

{\displaystyle (y^2+x^2)A + (y^2+x^2)B + y^2C + (y^2 + x^2)D + (x^3 + x^2y + x y^2 + y^3 ) = }

y
2

(
A
B
C
D
)

x
2

(
A
B
D
)
(

x
3

x
2

y
x

y
2

y
3

# )

{\displaystyle y^2(A+B+C+D) + x^2 (A+B+D) + (x^3 + x^2y + x y^2 + y^3 ) = }

# A
y
A
y
C

y
2

=
y
(
y
A
y
C

y
2

)
y
(
y
B
y
D
x
y
)

y
2

=

{\displaystyle A = yA+yC+y^2 = y(yA+yC+y^2) + y( yB+yD+xy) + y^2 = }

y
2

(
A
B
C
D
)
(

y
3

x

y
2

y
2

)

{\displaystyle y^2(A+B+C+D) + (y^3+xy^2+y^2)}

{

# E
y
E
x
F
(
x
y

)
2

# F

y
2

E

x
2

F
x
A
(

y
2

x
y

x
2

)
(

x
3

x
2

y
x

y
2

y
3

)

# A

y
2

E
(

y
3

x

y
2

y
2

)

{\displaystyle \begin{cases}
E = yE + xF + (x+y)^2 \\
F= y^2E+x^2F +xA + (y^2 + xy + x^2) + (x^3 + x^2y + x y^2 + y^3 ) \\
A = y^2E + (y^3+xy^2+y^2)
\end{cases}}

{

# E
y
E
x
F
(
x
y

)
2

# F

y
2

E

x
2

F
x

y
2

E
x
(

y
3

x

y
2

y
2

)
(

y
2

x
y

x
2

)
(

x
3

x
2

y
x

y
2

y
3

)

{\displaystyle \begin{cases}
E = yE + xF + (x+y)^2 \\
F= y^2E+x^2F +xy^2E + x(y^3+xy^2+y^2) + (y^2 + xy + x^2) + (x^3 + x^2y + x y^2 + y^3 )
\end{cases}}

F
(
1
−

x
2

# )
(

y
2

x

y
2

)
E
p
o
l
y
n
o
m
i
a
l

{\displaystyle F(1-x^2) = (y^2+xy^2)E + polynomial}

# E
y
E

x
(

y
2

x

y
2

)
E
x
.
p
o
l
y
n
o
m
i
a
l

(
1
−

x
2

)

(
x
y

)
2

{\displaystyle E = yE + \frac {x(y^2+xy^2)E + x.polynomial} {(1-x^2) }+ (x+y)^2 }

(
1
−

x
2

)
# E
(
1
−

x
2

)
y
E
x
(

y
2

x

y
2

)
E
x
.
p
o
l
y
n
o
m
i
a
l
(
1
−

x
2

)
(
x
y

)
2

{\displaystyle (1-x^2)E = (1-x^2)yE + x(y^2+xy^2)E + x.polynomial+ (1-x^2)(x+y)^2 }

x
3

y
2

x
2

y
3

−

x
3

y

x
2

y
2

x

y
3

x
3

x
2

y
x

y
2

x
2

2
x
y

y
2

−

x
2

y
2

x
2

y
−
x

y
2

−

x
2

−
y
1

{\displaystyle \frac {x^3y^2+x^2y^3-x^3y+x^2y^2+xy^3+x^3+x^2y+xy^2+x^2+2xy+y^2}{-x^2y^2+x^2y-xy^2-x^2-y+1} }

(checked in Maple) 3329\*x^14+1897\*x^13+1081\*x^12+616\*x^11+351\*x^10+200\*x^9+114\*x^8+65\*x^7+37\*x^6+21\*x^5+12\*x^4+7\*x^3+4\*x^2

# A
x
A
x
C

x
2

# B
x
A
x
x

# C
x
B
x
D
x
x

# D
x
B
x
D

x
2

{\displaystyle \begin{cases}
A = xA+xC+x^2\\
B= xA+xx \\
C = xB+xD+xx \\
D = xB+xD+x^2
\end{cases}}

A
B
C
# D
x
(
A
B
C
D
)
x
(
A
B
D
)
4

x
2

{\displaystyle A+B+C+D = x(A+B+C+D) + x(A+B+D) + 4x^2}

A
B
# D
x
(
A
B
C
D
)
x
A
3

x
2

{\displaystyle A+B+D = x(A + B+ C+ D) + xA + 3x^2 }

A
B
C
# D
(
x

x
2

)
(
A
B
C
D
)

x
2

A
4

x
2

3

x
3

{\displaystyle A+B+C+D = (x+x^2)(A+B+C+D) + x^2A + 4x^2 + 3x^3}

# A
x
A
x
C

x
2

=
x
(
x
A
x
C

x
2

)
x
(
x
B
x
D
x
x
)

x
2

=

{\displaystyle A = xA+xC+x^2 = x(xA+xC+x^2) + x( xB+xD+xx) + x^2 = }

x
2

(
A
B
C
D
)
(

x
3

x

x
2

x
2

)

{\displaystyle x^2(A+B+C+D) + (x^3+xx^2+x^2)}

{

# E
(
x

x
2

)
E

x
2

A
4

x
2

3

x
3

# A

x
2

E
2

x
3

x
2

{\displaystyle \begin{cases}
E = (x+x^2)E + x^2A + 4x^2 + 3x^3 \\
A = x^2E + 2x^3+x^2
\end{cases}}

# E
(
x

x
2

x
4

)
E
2

x
5

x
4

3

x
3

4

x
2

{\displaystyle E = (x + x^2 + x^4)E + 2x^5 + x^4 + 3x^3 + 4x^2}

e
.
g
.
# f

2

x
5

x
4

3

x
3

4

x
2

1
−
x
−

x
2

−

x
4

=
4

x
2

7

x
3

12

x
4

21

x
5

37

x
6

65

x
7

.
.
.

{\displaystyle e.g.f = \frac {2x^5 + x^4 + 3x^3 + 4x^2}{1-x-x^2-x^4} = 4x^2+ 7x^3+12x^4+21x^5+37x^6+ 65x^7+...}

# A
x
A
x
C
1

# B
x
A

# C
x
B
x
D

# D
x
B
x
D

{\displaystyle \begin{cases}
A = xA+xC+ 1\\
B= xA \\
C = xB+xD \\
D = xB+xD
\end{cases}}

A
B
C
# D
x
(
A
B
C
D
)
x
(
A
B
D
)
1

{\displaystyle A+B+C+D = x(A+B+C+D) + x(A+B+D) + 1}

A
B
# D
x
(
A
B
C
D
)
x
A
1

{\displaystyle A+B+D = x(A + B+ C+ D) + xA + 1 }

A
B
C
# D
(
x

x
2

)
(
A
B
C
D
)

x
2

A
1
x

{\displaystyle A+B+C+D = (x+x^2)(A+B+C+D) + x^2A + 1 + x}

# A
x
A
x
C
# 1
x
(
x
A
x
C
1
)
x
(
x
B
x
D
)
# 1

{\displaystyle A = xA + xC + 1 = x(xA+xC+1) + x( xB+xD) + 1= }

x
2

(
A
B
C
D
)
x
1

{\displaystyle x^2(A+B+C+D) + x+1 }

{

# E
(
x

x
2

)
E

x
2

A
x
1

# A

x
2

E
x
1

{\displaystyle \begin{cases}
E = (x+x^2)E + x^2A + x + 1 \\
A = x^2E + x+1
\end{cases}}

# E
(
x

x
2

x
4

)
E

x
3

x
2

x
1

{\displaystyle E = (x + x^2 + x^4) E + x^3 + x^2 + x + 1}

1
x

x
2

x
3

1
−
x
−

x
2

−

x
4

=
1
2
x
4

x
2

7

x
3

12

x
4

21

x
5

37

x
6

65

x
7

.
.
.

{\displaystyle \frac {1 + x + x^2 + x^3}{1-x-x^2-x^4} = 1+2x+4x^2+7x^3+12x^4+21x^5+37x^6+65x^7+...}

# A
A
0
C
0
00

# B
A
1
01

# C
B
0
D
0
10

# D
B
1
D
1
11

{\displaystyle \begin{cases}
A = A0+C0+00\\
B= A1+01 \\
C = B0+D0+10 \\
D = B1+D1+11
\end{cases}}

A
B
C
# D
(
A
B
C
D
)
0
(
A
B
D
)
1
(
0
1

)
2

{\displaystyle A+B+C+D = (A+B+C+D)0 + (A+B+D)1 + (0+1)^2}

A
B
# D
(
A
0
B
1
C
0
D
1
)
A
1
(
00
01
11
)

{\displaystyle A+B+D = (A0 + B1 + C0 + D1) + A1 + (00 + 01 + 11)}

A
0
B
1
C
0
D
# 1

{\displaystyle A0 + B1 + C0 + D1 = }

(
A
0
C
0
00
)
0
(
A
1
01
)
1
(
B
0
D
0
10
)
0
(
B
1
D
1
11
)
# 1

{\displaystyle (A0+C0+00)0 + (A1+01)1 + (B0+D0+10)0 + (B1+D1+11)1 = }

A
(
00
11
)
B
(
00
11
)
C
00
D
(
00
11
)
(
000
011
110
111
# )

{\displaystyle A(00+11) + B(00+11) + C00 + D(00+11) + (000 + 011 + 110 + 111 ) = }

(
A
B
C
D
)
00
(
A
B
D
)
11
(
000
011
110
111
# )

{\displaystyle (A+B+C+D)00 + (A+B+D)11 + (000 + 011 + 110 + 111 ) = }

# A
A
0
C
0
# 00
(
A
0
C
0
00
)
0
(
B
0
D
0
10
)
0
# 00

{\displaystyle A = A0+C0+00 = (A0+C0+00)0 + (B0+D0+10)0 + 00 = }

(
A
B
C
D
)
00
(
000
100
00
)

{\displaystyle (A+B+C+D)00 + (000 + 100 + 00)}

{

# E
E
0
F
1
(
0
1

)
2

# F
E
00
F
11
A
1
(
00
01
11
000
011
110
111
)

# A
E
00
(
000
100
00
)

{\displaystyle \begin{cases}
E = E0 +F1 + (0+1)^2\\
F = E00 + F11 + A1 + (00 + 01 + 11 + 000 + 011 + 110 + 111 ) \\
A = E00 + (000 + 100 + 00)
\end{cases}}

{

# E
E
0
F
1
(
0
1

)
2

# F
E
00
F
11
E
001
(
000
100
00
)
1
(
00
01
11
000
011
110
111
)

{\displaystyle \begin{cases}
E = E0 +F1 + (0+1)^2\\
F = E00 + F11 + E001 + (000 + 100 + 00)1 + (00 + 01 + 11 + 000 + 011 + 110 + 111 )
\end{cases}}

F
−
F
# 11
E
(
00
001
)
(
0001
1001
001
00
01
11
000
011
110
111
)

{\displaystyle F - F11 = E(00 +001) + (0001 + 1001 + 001 + 00 + 01 + 11 + 000 + 011 + 110 + 111 ) }

{

# E
E
0
F
1
(
0
1

)
2

E
# 11
E
011
F
111
(
0
1

)
2

11

F
1
−
F
# 111
E
(
001
0011
)
(
00011
10011
0011
001
011
111
0001
0111
1101
1111
)

{\displaystyle \begin{cases}
E = E0 + F1 + (0+1)^2\\
E11 = E011 +F111 + (0+1)^211\\
F1 - F111 = E(001 +0011) + (00011 + 10011 + 0011 + 001 + 011 + 111 + 0001 + 0111 + 1101 + 1111 )
\end{cases}}

E
−
E
0
−
E
11
E
011
−
E
001
−
E
# 0011

{\displaystyle E-E0 -E11 + E011 - E001-E0011 = }

(
0
1

)
2

−
(
0
1

)
2

11
(
00011
10011
0011
001
011
111
0001
0111
1101
1111
)

{\displaystyle
(0+1)^2 - (0+1)^211 + (00011 + 10011 + 0011 + 001 + 011 + 111 + 0001 + 0111 + 1101 + 1111 ) }

=
(
0
1

)
2

−
1011
(
00011
10011
001
011
111
0001
1101
)

{\displaystyle = (0+1)^2 - 1011 + (00011 + 10011 + 001 + 011 + 111 + 0001 + 1101) }

x
3

y
2

x
2

y
3

−

x
3

y

x
2

y
2

x

y
3

x
3

x
2

y
x

y
2

x
2

2
x
y

y
2

−

x
2

y
2

x
2

y
−
x

y
2

−

x
2

−
y
1

{\displaystyle \frac {x^3y^2+x^2y^3-x^3y+x^2y^2+xy^3+x^3+x^2y+xy^2+x^2+2xy+y^2}{-x^2y^2+x^2y-xy^2-x^2-y+1} }

(checked in Maple) 3329\*x^14+1897\*x^13+1081\*x^12+616\*x^11+351\*x^10+200\*x^9+114\*x^8+65\*x^7+37\*x^6+21\*x^5+12\*x^4+7\*x^3+4\*x^2

## probabilities bayes

Here how Bayes may join the lulu solution
a)

1

1
13

=

P
(
A
S

i
n

h
a
n
d

s
u
c
c
e
s
s
)

P
(
s
u
c
c
e
s
s

A
S

i
n

h
a
n
d
)

=

P
(
A
S

i
n

h
a
n
d
)

P
(
s
u
c
c
e
s
s
)

=

x

1
52

{\displaystyle \frac{1}{ 1\over 13} = \frac {P(AS\ in\ hand\ |\ success) } {P(success\ |\ AS\ in\ hand)} = \frac {P(AS\ in\ hand)}{P(success)} = \frac {x} {1\over 52}}

and we get the first 1/4

b) reusing it,

x

12
13

=

P
(
A
S

i
n

h
a
n
d

f
a
i
l
u
r
e
)

P
(
f
a
i
l
u
r
e

A
S

i
n

h
a
n
d
)

=

P
(
A
S

i
n

h
a
n
d
)

P
(
f
a
i
l
u
r
e
)

=

1
4

51
52

{\displaystyle \frac{x}{ 12\over 13} = \frac {P(AS\ in\ hand\ |\ failure) } {P(failure\ |\ AS\ in\ hand)} = \frac {P(AS\ in\ hand)}{P(failure)} = \frac {1\over 4} {51\over 52}}

we obtain the 1 - 12/51

c) in fact we are interested in

x

(

12
13

)

10

=

P
(
A
S

i
n

h
a
n
d

10

f
a
i
l
u
r
e
s
)

P
(
10

f
a
i
l
u
r
e
s

A
S

i
n

h
a
n
d
)

=

P
(
A
S

i
n

h
a
n
d
)

P
(
10

f
a
i
l
u
r
e
s
)

=

1
4

y

{\displaystyle \frac{x} { ( {12 \over 13} ) ^{10} } = \frac {P(AS\ in\ hand\ |\ 10\ failures) } {P(10\ failures\ |\ AS\ in\ hand)} = \frac {P(AS\ in\ hand)}{P(10\ failures)} = \frac {1\over 4} {y}}

where

# y
P
(
10

f
a
i
l
u
r
e
s
# )
P
(
10

f
a
i
l
u
r
e
s
∩
A
S

i
n

h
a
n
d
)
P
(
10

f
a
i
l
u
r
e
s
∩
A
S

n
o
t

i
n

h
a
n
d
)

{\displaystyle y = P(10\ failures) = P(10\ failures \cap AS\ in\ hand) + P(10\ failures \cap AS\ not\ in\ hand) }

hence the result

# x

P
(
10

f
a
i
l
u
r
e
s
∩
A
S

i
n

h
a
n
d
)

P
(
10

f
a
i
l
u
r
e
s
)

{\displaystyle x = \frac{P(10\ failures \cap AS\ in\ hand)} {P(10\ failures)}}

In fact

a) Bayes is not needed
b) Bayes is not needed
c) Bayes in not needed.

## avoiding three consecutives

{

A
# A
B
A
a

B
# B
A
B
b

A
# B
A
A
b
B
A
b

B
# A
B
B
a
A
B
a

{\displaystyle \begin{cases}
AA = BAa \\
BB= ABb \\
AB = AAb+ BAb\\
BA = BBa + ABa
\end{cases}}

A
A
B
B
A
B
B
# A
B
A
a
A
B
b
A
A
b
B
A
b
B
B
a
A
B
# a
B
B
a
a
A
B
a
a
A
A
b
b
B
A
b
b

{\displaystyle AA + BB +AB+BA= BAa + ABb + AAb+ BAb +BBa + ABa = BBaa + ABaa + AAbb+ BAbb }

A
B
# D
(
y
A
x
B
y
C
x
D
)
x
A
3

{\displaystyle A+B+D = (yA + xB+ yC + xD) + xA + 3 }

y
A
x
B
y
C
x
# D

{\displaystyle yA + xB + yC + xD = }

y
(
y
A
y
C
1
)
x
(
x
A
1
)
y
(
y
B
y
D
1
)
x
(
x
B
x
D
1
# )

{\displaystyle y(yA+yC+1) + x(xA+1 ) + y(yB+yD+1) + x (xB+xD + 1) = }

(

y
2

x
2

)
A
(

y
2

x
2

)
B

y
2

C
(

y
2

x
2

)
D
(

x
3

x
2

y
x

y
2

y
3

# )

{\displaystyle (y^2+x^2)A + (y^2+x^2)B + y^2C + (y^2 + x^2)D + (x^3 + x^2y + x y^2 + y^3 ) = }

y
2

(
A
B
C
D
)

x
2

(
A
B
D
)
2
x
2
y
# )

{\displaystyle y^2(A+B+C+D) + x^2 (A+B+D) + 2x+2y) = }

# A
y
A
y
C
# 1
y
(
y
A
y
C
1
)
y
(
y
B
y
D
1
)
# 1

{\displaystyle A = yA+yC + 1 = y(yA+yC + 1) + y( yB+yD+ 1) + 1 = }

y
2

(
A
B
C
D
)
1
2
y

{\displaystyle y^2(A+B+C+D) + 1+2y }

{

# E
y
E
x
F
4

# F

y
2

E

x
2

F
x
A
3
2
x
2
y

# A

y
2

E
1
2
y

{\displaystyle \begin{cases}
E = yE + xF + 4 \\
F= y^2E+x^2F + xA + 3 + 2x + 2y \\
A = y^2E + 1 + 2y
\end{cases}}

{

# E
y
E
x
F
4

# F

y
2

E

x
2

F
x

y
2

E
x
(
1
2
y
)
3
2
x
2
y

{\displaystyle \begin{cases}
E = yE + xF + 4 \\
F= y^2E+x^2F +xy^2E + x(1 + 2y) + 3 + 2x + 2y
\end{cases}}

F
(
1
−

x
2

# )
(

y
2

x

y
2

)
E
3
3
x
2
y
2
x
y

{\displaystyle F(1-x^2) = (y^2+xy^2) E + 3 + 3x + 2y + 2xy }

# E
y
E

x
(

y
2

x

y
2

)
E
x
.
p
o
l
y
n
o
m
i
a
l

(
1
−

x
2

)

4

{\displaystyle E = yE + \frac {x(y^2+xy^2)E + x.polynomial} {(1-x^2) } + 4 }

(
1
−

x
2

)
# E
(
1
−

x
2

)
y
E
x
(

y
2

x

y
2

)
E
x
.
p
o
l
y
n
o
m
i
a
l
(
1
−

x
2

)
4

{\displaystyle (1-x^2)E = (1-x^2)yE + x(y^2+xy^2)E + x.polynomial+ (1-x^2)4 }

## a problem in math stackexchange

1. The cycle index polynomial of

D
6

{\displaystyle D\_6}

 is

1
12

[

x
1
6

3

x
1
2

x
2
2

4

x
2
3

2

x
3
2

2

x
6

]

{\displaystyle \frac{1}{12}[x\_1^6+3x\_1^2x\_2^2+4x\_2^3+2x\_3^2+2x\_6]}

. So, the number of necklaces is the coefficient of

a
3

b
3

{\displaystyle a^3b^3}

 in the expansion of

1
12

[
(
a
b

)
6

3
(
a
b

)
2

(

a
2

b
2

)
2

4
(

a
2

b
2

)
3

2
(

a
3

b
3

)
2

(

a
6

b
6

)
]
,

{\displaystyle \frac{1}{12}[(a+b)^6+3(a+b)^2(a^2+b^2)^2+4(a^2+b^2)^3+2(a^3+b^3)^2+(a^6+b^6)],}

which is equal to

1
12

[

(

6
3

)

3

(

2
1

)

(

2
1

)

2

(

2
1

)

]

=
3

{\displaystyle \displaystyle \frac{1}{12}\left[\binom{6}{3}+3\binom{2}{1}\binom{2}{1}+2\binom{2}{1}\right]=3}

.

2. The cycle index polynomial of

D
8

{\displaystyle D\_8}

 is

1
16

[

x
1
8

4

x
1
2

x
2
3

5

x
2
4

2

x
4
2

4

x
8

]

{\displaystyle \frac{1}{16}[x\_1^8+4x\_1^2x\_2^3+5x\_2^4+2x\_4^2+4x\_8]}

. So, the number of necklaces is the coefficient of

a
4

b
3

c

{\displaystyle a^4b^3c}

 in the expansion of

1
16

[

(
a
b
c

)
8

4
(
a
b
c

)
2

(

a
2

b
2

c
2

)
3

5
(

a
2

b
2

c
2

)
4

2
(

a
4

b
4

c
4

)
2

4
(

a
8

b
8

c
8

)

]

{\displaystyle \frac{1}{16}\left[(a+b+c)^8+4(a+b+c)^2(a^2+b^2+c^2)^3+5(a^2+b^2+c^2)^4+2(a^4+b^4+c^4)^2+4(a^8+b^8+c^8)\right]}

which is equal to

1
16

[

(

8
4

)

(

4
3

)

4

(

2
1

)

(

3
2

)

]

=
19

{\displaystyle \displaystyle \frac{1}{16}\left[\binom{8}{4}\binom{4}{3}+4\binom{2}{1}\binom{3}{2}\right]=19}

.