**How many distinct patterns can you create with a thread while sewing on a four-hole button?**

Unfortunately, there is no information on the Web what the answer was and had Kolmogorov found it himself. In a book about Grigori Perelman, the author Masha Gessen admitted that two professional mathematicians, both former students of Kolmogorov, had given different answers.

In the beginning I found the number of patterns in several cases where single-color thread was involved. Later (in a different setting, that of a telecommunications network) I showed how the number of patterns depends on the number of colors too. Now, let me find the number of patterns

**p**in case of different-color threads, taking into account that two (or more) diagonals (e.g. red and green) look very differently when they intersect each other (and thus form different patterns):

__Assumptions:__

A1. It is mandatory to utilize the buttonholes. There are many ways to sew on a button without utilizing the buttonholes but let us forget about them for the time being.

A2. All buttonholes are located on the vertices of a generic convex polygon, i.e. a convex polygon with no more than two diagonals intersecting at any point in its interior. The case of a regular convex

**n**-gon where

**n**is even (and greater than 4) is more complicated and is to be addressed separately.

A3. Different-color threads might be used for different segments between the buttonholes. Let us use the adjective

*painted*for a segment that is covered by a thread and the verb

*paint*for the action itself.

A4. Only buttonhole-to-buttonhole connections are used. No cross-border connections are allowed.

__Calculation:__

1. The more colors (

**c**) we have the more patterns there are. According to Wikipedia, there are 10,000,000 different colors that can be distinguished by the human eye.

2. The more buttonholes (

**n**) we have the more thread segments connecting the buttonholes we have. A segment could be an edge or a diagonal, therefore (generally speaking) the greater the

**n**the greater the number of intersection points made by diagonals. For instance, if

**n**is 2 or 3 there are no diagonals, therefore there are no intersection points whatsoever.

3. When trying to find the number of patterns, there are 4 things to take into account:

3.1. The number of available colors

**c**,

3.2. The number of the edges

**e**, where

**e = n**,

3.3. The number of diagonals

**d**, where

**d = (1/2)*(n-3)*n**, and

3.4. The number of intersection points made by diagonals of a generic convex polygon

**I(n)**, which according to Poonen and Rubinstein is

**I(n) = C(n,4)**(OEIS sequence A000332).

4. We already know how to find

**p**when we know 3.1., 3.2. and 3.3., i.e.

**p = {[(c+1)^n]*[(c+1)^[(1/2)*(n-3)*n]}-1**=

or

**p**=

**{(c+1)^[(n-1)*n/2]}-1**

(OEIS sequence A206601 in the case of

**c=2**). Now we have to find how

**p**is influenced by

**I(n)**.

5. Which colors must two diagonals have so that when they intersect each other two different patterns are observed? It is obvious that:

5.1. There should be no zero-color diagonals, meaning that both diagonals must be painted (i.e. there have to exist two threads intersecting each other) and

5.2. Both diagonals must be painted in different colors as two intersecting same-color segments (green, for instance) look exactly the same no matter which is above or below the other.

5.3. It follows from 5.1. and 5.2. that we have to additionally count (i.e. count for a second time) only those intersections where two differently painted diagonals intersect each other. Therefore, the additional multiplier (reflecting the additional counting) will be

**c*(c-1)**raised to

**I(n)**-th power.

6. Now the formula will look like this

**p =**

**{[**

**(c+1)^n]*(c+1)^[(1/2)*(n-3)*n]*[c*(c-1)]^C(n,4)**

**}-1**

or

**p = -1 +**

**{**

**(c+1)^[(1/2)*(n-1)*n]}*[c*(c-1)]^C(n,4)**

7. In the case of Kolmogorov’s button (

**c=10,000,000**,

**n=4**and

**I(n)=C(4,4)=1**)

**p = -1 + [(10,000,001^6)*(10,000,000*9,999,999)^1]**

**≈**

**10^56**.