# Dynamic and Programmatic Analysis of Fibonacci Word Density

D Abdullah, J Hamoud

► To cite this version:

D Abdullah, J Hamoud. Dynamic and Programmatic Analysis of Fibonacci Word Density. Conference 67th All-Russia Scientific Conference MIPT, MIPT, Apr 2025, Moscow, Russia. pp.27. hal-05025111

HAL Id: hal-05025111

https://hal.science/hal-05025111v1

Submitted on 8 Apr 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# DYNAMIC AND PROGRAMMATIC ANALYSIS OF
FIBONACCI WORD DENSITY

D. ABDULLAH AND J. HAMOUD

**ABSTRACT.** Fibonacci word is the arch type of the Sturmian word, and it is one of the most studied of combinatorics on words. We studied the properties of the Fibonacci word and found its density for limited value then by calculating the limit associated with the general relation of $\frac{F(n)}{F(n+1)}$. We also generated the density function through the integral relation of $\int_{a}^{b} f(x)dx$ where $D(n) = \int_{a}^{b} f(x)dx$ and $f(x) = e^{-x/\tau}g(x)$. we presented the first study of the density of the Fibonacci word, in addition to some analysis through programming.

**Keywords:** Combinatorics, Words, Sturmian, Density, Fibonacci Word, Palindrome.

MSC 2020: 68R15; 05C42; 11B05; 11R45; 11B39.

## 1. INTRODUCTION

Combinatorics on words delves into sequences of symbols (or "words") from a finite alphabet, there are alotted of studies about combinatorics on words. The important basic concepts include as *Non-Commutative Monoids* which it focus on sequences where the symbol order matters. *Subword Complexity* which it analyses the number of unique subwords derivable from a word. and *Infinite Words and Patterns* which it studies characteristics and regularities in infinitely repeated sequences. It's all about understanding the complexities and patterns within symbol strings.

In 2014, Rigo, M. mention in [1] to Word combinatorics which has important applications in other branches of mathematics such that **Formal Language Theory** where it investigates the construction of languages and how word combinations shape language structure and parsing algorithms, **Automata Theory** which it examines the relationship between automata (abstract machines recognizing patterns) and words to understand word processing and recognition by computer
models, and **Number Theory** where we have in number theory explore connections between arithmetic aspects and syntactical features of integer representations as finite words over a digit alphabet. Highlights include Cobham's theorem, linking growth rates of sequences described by various numeration systems (see [1, ?]).

In 2006, Glen, A., in [2] in a PhD dissertation mentions to definition of Fibonacci word as an infinite binary sequence generated by a specific morphism. Starting with the initial conditions $F(0) = 0$ and $F(1) = 1$, the sequence is constructed as follows:

$$F(n) = F(n-1)F(n-2) \quad \text{for } n \ge 2$$

The first few Fibonacci words are:

$$F(0) = 0, F(1) = 1, F(2) = 01, F(3) = 010, F(4) = 01001, F(5) = 01001010, \dots, \text{and so on.}$$

Also, in [2] mention to Sturmian Words as Fibonacci words are a subset of Sturmian words, which are recognised for their complex combinatorial structure. They have qualities like a balance between the number of 0s and 1s, and they can be used to describe different phenomena in mathematics and computer science.

In 2013, Ramírez, J.L., & Rubiano, G.N. in [3] mention to k-Fibonacci Words as The k-Fibonacci words are an extension of the Fibonacci word notion that generalises Fibonacci word features to higher dimensions. These words were investigated for their distinct curves and patterns. Also in 2014, Catarino, P, mention to Binet's formula as $F_{k,n} = \frac{a_1^n - a_2^n}{a_1 - a_2}$; $a_1 > a_2$.

In 2023, Rigo, M., Stipulanti, M., & Whiteland, M.A. in [5] mentioned to sturmian words and Thue-Morse sequence, which is $0 \to 01, 1 \to 10$, has k-binomial complexity for $k \ge 2$.

Recently, in 2024, Bacon, M.R., Cook, C.K., Flórez, R., Higuita, R.A., Luca, F., & Ramírez, J.L, in [6] mention to $\sqrt{\lim_{n \to \infty} \frac{F_{n+2}}{F_n}} = \sqrt{\phi}$. in right tringle where an adjacent side of $\sqrt{F_{n+1}}$, an opposite side of $\sqrt{F_n}$ and a hypotenuse of $\sqrt{F_{n+2}}$.

**1.1. Preliminaries.** In this section we introduce an important concepts in combinatorics on words, especially on words that consider one of the most intuitive things we can define is the following.

**Definition 1.** Let be a finite set of elements of the series A as: $(a_1, a_2, \dots, a_n); a_i \in A$, then we have All the words that we can mould from A will be denoted by the symbol $A^*$, and we define for them a binary operation in the following form:

$$(a_1, a_2, \dots, a_n)(b_1, b_2, \dots, b_n) = (a_1, a_2, \dots, a_n, b_1, b_2, \dots, b_n)$$
This binary process will allow us to form the following word: $(a_1, a_2, \dots, a_n)$; $a_i \in A$ And all the words that we formed from A will be denoted by: $A^+ = A^* - 1$, and we call them the semi-group A (see [7]).

We have the word $w = (a_1, a_2, \dots, a_n)$; $a_i \in A$ is made up of $n^{th}$ letters, we denote by $|w| = n$ the length of the word $w$. If $w$ does not contain letters, then its length will be $|w| : |w| = 0$. And if we have a function $w \mapsto |w|$ that is a morphism function of a free monoid $A^*$ in addition to a monoid $\mathbb{N}$ of positive integers, then we take a subset $B$ of $A$, and we denote by $|w|_B$ the number of letters of $w$ that belong to $B$. Therefore, $|w| = \sum_{a \in A} |w|_a$.

## 1.2. Infinite Square-Free Words.
consider Thue-Morse is a basic base of Fibonacci word where the infinite word of Thue-Morse has square factors. In fact, the only forecourt-free words over two letters $a$ and $b$ are: $\{a, b, ab, aba, bab\}$. On the opposite, there will be infinite square-free words over three letters. This will now be shown.

**Definition 2.** *let $A = \{a, b\}$, and $B = \{a, b, c\}$. Define a morphism:*

$$ \delta : B^* \to A^*; \quad \text{where } \delta(c) = a, \delta(b) = ab, \delta(a) = abb $$

For any infinite word $b$ on $B$, $\delta(b) = \delta(b_0)\delta(b_1)\dots\delta(b_n)$ (see [7]).

is an endless word on $A$ that is clearly defined that begins with the letter $a$, M. Lothaire in [7]. Consider, on the other hand, an infinite word $a$ on $A$ that begins with $a$ and has no overlapping elements. Then $a$ can be considered as:

$$ a = y_0y_1\dots y_n\dots, \quad \text{where } y_n \in \{a, ab, abb\} = \delta(B) $$

Since $bbb$ connects, each an in an is actually followed by no more than two $b$ before a new $a$. The factorization is also special. Consequently, there is a special infinite word $b$ on $B$ such that $\delta(b) = a$ (see [7]).

Grimm, Uwe in 2001, in [8] introduced some definition are important about Infinite square-free words and bounds as:

**Definition 3 (Square-Free Words [8]).** For any sequences that do not contain any consecutive repeated substrings called (squares).

**Example 1 (Binary Square-Free Words).** Limited to short sequences like: $a, b, ab, ba, aba, bab$.

**Definition 4 (Ternary Square-Free Words [?, 9]).** Can be infinitely long, and the number of such words grows exponentially with their length called Ternary Square-Free Words.

Brandenburg in [9] introduce a definition on bounds linked with Ternary Square-Free Words as
**Proposition 1.1** (Bounds [9]). *The number of ternary square-free words of length n is bounded by*

$$6 \times 1.032^n \leq s(n) \leq 6 \times 1.379^n$$

as shown by Brandenburg in 1983.

Zolotov, Boris, Zolotov, Boris. in [10] shown in an example Extending a square-free word to avoid ab such that in figure 1, we can make linked with Ternary Square-Free Words, see following figure.

<figure><img src="image_2.png" /><figcaption>FIGURE 1. Extending a square-free word to avoid ab. [10]</figcaption></figure>

**Definition 5** (The Number of Occurrences). *If we have the element $a \in A$ and $w \in A^*$ (we write $A^*$ it's the set of all words on A) intends the number of iterations $a$ in $w$ by $|w|_a$ and denotes the number of occurrences of $b$ in $w$ by $|w|_b$. If $w = abaab$, we can put: $|w|_a = 3, |w|_b = 2$. (see [7]).*

## 2. PALINDROME AND SCATTERED PALINDROMIC

In this subsection, we will give a proof of the subsequence leading to a subword, which is an essential part when dealing with subwords in Fibonacci. A **palindrome** is a sequence that reads the same forwards and backwards. This concept applies to various forms, including words, phrases, numbers, and even sequences in mathematics. The popular types of palindromes is: Character Palindromes, Word Palindromes, Phrase Palindromes, Number Palindromes, Date Palindromes, Biological Palindromes.
In fact, what we are interested in Word Palindromes and Number Palindromes in this paper which define a **palindrome** in [11] such a sequence $a_1, a_2, ..., a_n$ is considered a palindrome if: $a_i = a_{n+1-i}$; $1 \le i \le n$. This means that the first element is equal to the last element, the second element is equal to the second last element, and so on also from [11] we can insert code by python for know Whether it is the number is palindrome or no.

```python
# Function to check if a number is a palindrome
def is_palindrome(num):
    num_str = str(num)
    # Check if the string is equal to its reverse
    return num_str == num_str[::-1]

# Main function
def main():
    while True:
        try:
            # Input from the user with prompt
            number = int(input("Enter a number: "))
            break  # Exit loop if input is valid
        except ValueError:
            print("Please enter corecct integer.")
    # Check if the number is a palindrome
    if is_palindrome(number):
        print(f"{number} is a palindrome.")
    else:
        print(f"{number} is not a palindrome.")

if __name__ == "__main__":
    main()
```

**Definition 6.** Strings or sequences that contain subsets of characters that can create palindromic structures are referred to be scattered palindromic. Sporadic palindromic structures are more flexible than standard palindromes, which have tight symmetry requirements. For scattered palindromes, we can define them in terms of their indices. A sequence $s_1, s_2, ..., s_k$ is scattered palindromic if there exists some mapping such that:

$$s_i = s_j \quad \text{where } j = k + 1 - i \quad \text{for some } i, j.$$

**Example 2.** Let be a word $w = aabb$, The scattered palindromic sub strings include:

(1) Single characters: $a, b,$
(2) Pairs of identical characters: aa, bb,

(3) Longer combinations that still maintain some palindromic properties: aba (though not present in "aabb").

One way to find distributed palindromic sub strings in a given string is to search for every conceivable letter combination and see whether any of them can be rearranged to create palindromes. This method typically requires a lot of processing power because it creates every potential sub string and verifies each one's characteristics (see [12]).

**Proposition 2.1.** [13] Let $w$ be a finite word. Then, $P(w) \le |w|$.

**Proposition 2.2.** [14] For a given finite word $w$, $P(w) \le |w| \le SP(w)$.

**Lemma 2.3.** If we have $w$ any palindrome word, then it's said that a word $v \in A^*$ is a subword of another word $x \in A^*$ if: $v = a_1a_2...a_n, a_i \in A, n \ge 0$ then we have also as: $\exists y_0, y_1, ..., y_n \in A; x = y_0a_1y_1a_2...y_na_n$. Therefore, we have:

$$|p(w)| \le |sp(w)|; \forall w \in \Sigma$$

$$\text{where } sp(w) = \sum_{t=1}^{|w|} sp_t(w); \quad t: \text{length of word } w.$$

*Proof.* Let be $v$ a sequence where $v = a_1a_2...a_n, a_i \in A, n \ge 0$ and let be $x = y_0a_1y_1a_2...y_na_n$. Since $v$ is a subsequence of $x$ as $v \subset x$, it's a subword of $x$. If we have a word $w = w^R$ is palindrome when be read both ways, so we see the first and second halves of the string are mirror images of each other.

And we refer to a dispersed $w$ as a scattered palindromic subword if it's a palindrome.

The set of all non-empty palindromic subwords and dispersed palindromic subwords of $w$ are denoted, respectively, by $PAL(w)$ and $SPAL(w)$. Also,

$$P(w) = |PAL(w)| \text{ and } SP(w) = |SPAL(w)|.$$

Therefore we will have many cases, as:

**Case 1:** for finite words:

If we have the word $w = abaa$, we can put:

$$p(w) = \{a, b, aa, aba\} \Rightarrow |p(w)| = 4$$

$$sp(w) = \{a, b, aa, aba, aaa\} \Rightarrow |sp(w)| = 5.$$
Also, for the word $w = abab$, we can write:

$$p(w) = \{a, b, aa, bb, aba, bab\} = sp(w) \\ \Rightarrow |p(w)| = |sp(w)| = 6.$$

**Case 2:** for the infinite word:

if we have the word as $w = abbaa...$, we can see:

$$p(w) = \{a, b, abba, aa, bb, ...\} \Rightarrow |p(w)|n \\ sp(w) = \{a, b, abba, aa, bb, aba, aaa, ...\} \Rightarrow |sp(w)| \ge n$$

from 2.1 we get on:

$$|p(w)| \le |sp(w)|; \forall w \in \Sigma \\ sp(w) = \sum_{t=1}^{|w|} sp_t(w); \quad t: \text{length of word } w.$$

as desire.

<figure><img src="image_3.png" /></figure>

**Lemma 2.4.** [14] At most $F_n$ extra scattered palindromic subwords can be created on the concatenation of a letter to a word of length $n-1$.

### 3. FIBONACCI WORD AND THE FIRST FEW SUBWORDS

A particular infinite sequence in a two-letter alphabet makes up the infinite Fibonacci word. Let $f_1 = 1, f_2 = 0, f_n = f_{n-1}f_{n-2}$ the concatenation of the two previous terms.

Additionally, the following morphism defines it: $\sigma: 0 \to 01, 1 \to 0$ The Fibonacci words are given following:

$f_1 = 1, f_2 = 0, f_3 = 01, f_4 = 010, f_5 = 0100, f_6 = 010010, f_7 = 01001011001001, \dots$

**Proposition 3.1** (Infinite Fibonacci word [15]). The infinite Fibonacci word is the limited sequence of the unlimited sequence $f_\infty$. then we have:

$$\lim_{n \to \infty} f(n) = 0100101001001010010100100101001001 \dots$$

It's clear to see that $|fn|$ is the $n^{th}$ Fibonacci number, which is called the "Fibonacci word". We have claimed that the Fibonacci word, which is a Sturmian word, is also pure morphic, exactly, Berstel and Karhum in [16] mention to $f = w_{\frac{1}{2}}$; where $\varphi = \frac{1+\sqrt{5}}{2}$ is the golden ratio.

The Fibonacci word is an infinite sequence of binary digits that can be constructed by starting with the two binary digits "0" and "1" and repeatedly appending the previous term to the current term. To find the subwords of the Fibonacci word, we can look at contiguous sequences of digits in the sequence.
**Example 3.** The first few subwords of the Fibonacci word are:
0, 1, 01, 10, 101, 010, 1010, 0101, 10101, 01010, 101010, ...

In order to find the density of zero and one in the Fibonacci word for subwords with a length of less than thirty, we can start by looking at the first few subwords of the Fibonacci word.

We can see the subwords alternate between starting with 0 and starting with 1. This means that the density of zero and one in the Fibonacci word is equal, and is approximately $\frac{1}{2}$.

**Theorem 3.2.** for the infinite Fibonacci word. we have $f_1 = 1, f_2 = 0, f_n = f_{n-1}f_{n-2}$, there are density of palindromes of Fibonacci word is:

<table><caption>TABLE 1. density of palindromes in Fibonacci word for length 2, 3, 4</caption><thead><tr><td>Length</td><td>Density of Palindromes</td></tr></thead><tbody><tr><td>2</td><td>1/2</td></tr><tr><td>3</td><td>1/13, 2/13</td></tr><tr><td>4</td><td>1/21, 2/21</td></tr></tbody></table>

*Proof.* To find the density of palindromes in the Fibonacci word, we can start by looking at the palindromes of length 2. These are: 00, 11, 01, 10. We can see that the palindromes are the same form 3.1 as:

* the subwords of length 2, except for the palindrome "11" which is not a subword of length 2. The density of palindromes of length 2 in the Fibonacci word is equal to the density of subwords of length 2, which is also approximately $\frac{1}{2}$.

* For palindromes of length 3, we have: 000, 010, 101, 111, 001, 100. We can see that there are now six palindromes of length 3, and they do not all have the same density. In particular, the palindromes 000 and 111 each appear only once in the first 13 letters of the Fibonacci word, while the other four palindromes each appear twice. This means that the density of the palindromes 000 and 111 is approximately $\frac{1}{13}$, while the density of the other palindromes is approximately $\frac{2}{13}$.

* For palindromes of length 4, we have: 0000, 0101, 1010, 1111, 0001, 1001, 0110, 1100. We can see there are now eight palindromes of length 4, and they do not all have the same density. In particular, the palindromes 0000 and 1111 each appear only once in the first 21 letters of the Fibonacci word, while the other six palindromes
each appear twice. This means that the density of the palindromes 0000 and 1111 is approximately $\frac{1}{2^1}$, while the density of the other palindromes is approximately $\frac{2}{2^1}$.

* For palindromes of length 5 and greater, the number of palindromes and their densities become more complicated to calculate. However, it's known that the density of palindromes in the Fibonacci word approaches zero as the length of the palindromes increases. This is because the Fibonacci word has a complicated and irregular structure, and as the length of the palindromes increases, it becomes more and more difficult for them to appear in the word with any significant frequency.

finally, we can say the density of zero and one in the Fibonacci word for subwords with a length of less than thirty is approximately $\frac{1}{2}$. The density of palindromes in the Fibonacci word depends on the length of the palindromes, with shorter palindromes having a higher density than longer palindromes. However, as the length of the palindromes increases, their density approaches zero. □

**3.1. Calculate The Density of Fibonacci Word.** The density of a subword $w$ in the Fibonacci word of length $n$ is defined as the number of occurrences of $w$ in the first $n$ terms of the Fibonacci word divided by $n$. In other words, it's the proportion of the first $n$ digits of the Fibonacci word that are equal to $w$. To calculate the density of Fibonacci word of length $n$, we need to start by generating the first $n$ terms of the Fibonacci word, then we can count the number of times that the subword $w$ appears in the first $n$ terms of the Fibonacci word, and finally we divide by this number to obtain the density of each word. This means the density of $w$ is given by:

$$D(w) = \frac{C(w)}{n}$$

**Example 4.** suppose we want to calculate the density of the subword "101" in the first 1000 terms of the Fibonacci word. We can generate the first 1000 terms of the Fibonacci word and count the number of occurrences of "101" in this sequence. Let's say we find that "101" occurs 89 times in the first 1000 terms. Then the density of "101" is:

$$D("101") = \frac{89}{1000} = 0.089.$$

**Proposition 3.3.** approximately 8.9% of the first 1000 digits of the Fibonacci word are equal to "101".
power of $n$. then we have:

$$ \frac{\varphi^n}{\sqrt{5}} \to \infty \quad \text{as} \quad n \to \infty. $$

Thus, we can conclude that with the notice in 3.1 as:

$$ \lim_{n \to \infty} F_n = \lim_{n \to \infty} \frac{\left(\frac{1+\sqrt{5}}{2}\right)^n}{\sqrt{5}} = \infty. $$

□

in 2024 Bacon, M.R., Cook, C.K., Flórez, R., Higuita, R.A., Luca, F., & Ramírez, J.L. in [6] introduced the following theorem, to calculation of the limit of Fibonacci numbers with respect to a right triangle, which is based on the fundamental principle of the golden ratio.

**Theorem 3.6** ([6]). For $n \ge 1$, we have in a triangle exhibits an adjacent side of $\sqrt{F_{n+1}}$, an opposite side of $\sqrt{F_n}$ and a hypotenuse of $\sqrt{F_{n+2}}$, we have:

$$ \sqrt{\lim_{n \to \infty} \frac{F_{n+2}}{F_n}} = \sqrt{\varphi}. $$

**Theorem 3.7.** The density of Fibonacci word a particular letter in the word using the following formula:

$$ \lim_{n \to \infty} D(n) = \lim_{n \to \infty} \left( \frac{F(n)}{F(n+1)} \right) = \varphi - 1 $$

where $\varphi$ is the golden ratio.

*Proof.* The density of a sequence is a measure of how many times a particular symbol appears in the sequence, relative to the total length of the sequence. In the case of Fibonacci word, the density of the symbol 1 can be shown to be the golden ratio, which is approximately 1.61803398875.. as in 3.5.

To see why this is the case, let's consider the process of constructing Fibonacci word. We start with two symbols, 0 and 1, and at each step, we add the previous two symbols to the end of the sequence. This means from theorem 3.2 that the number of 1's in the sequence is equal to the number of times we add the symbol 1 to the sequence (see figure ??), then we have:

* At the first step, we add a single 1 to the sequence, so the density of 1's is $\frac{1}{2}$.

* At the second step, we add another 1 to the sequence, so the density of 1's becomes $\frac{2}{3}$.
• At the third step, we add two 1's to the sequence, so the density of 1's becomes $\frac{3}{5}$.

At each subsequent step, the density of 1's approaches the golden ratio $\varphi$ as the length of the sequence grows larger and larger.

Otherwise, we can be proven mathematically using the fact Fibonacci word can be generated using a substitution rule, where each occurrence of the letter "0" is replaced with the string "01" and each occurrence of the letter "1" is replaced with the string "0".

Using this substitution rule, we can come to a formula for the $n^{th}$ letter of the Fibonacci word in terms of the binary expansion of $n$. Specifically, the $n^{th}$ letter of the Fibonacci word is equal to 1 if the number of ones in the binary expansion of $n$ is one more than a multiple of 3, and 0 otherwise(see ??).

This can be shown mathematically using the fact that the ratio of consecutive Fibonacci numbers like in 3.1 shown approaches the golden ratio $\varphi$ as the numbers get larger. Specifically, let $F(n)$ denote the $n^{th}$ Fibonacci number (with $F(1) = 0$ and $F(2) = 1$).

Using the formula for the $n^{th}$ Fibonacci number:

$$F(n) = \frac{\varphi^n - (1 - \varphi)^n}{\sqrt{5}}$$

So the density of 1's in the first $n$ terms of the Fibonacci word is given by:

$$D(n) = \frac{F(n)}{F(n + 1)}$$

This can be done by considering the density of the ones in the first $2^n$ letters of the Fibonacci word and using the fact that the number of ones in the binary expansion of the integers from 0 to $2^n-1$ is approximately:

$$\frac{2^n}{2^n\varphi - 1}$$

More specifically, we can show that the density of ones in the first $2^n$ letters of the Fibonacci word is approximately: $\frac{2^n}{\varphi}$, which approaches $\varphi$ as $n$ goes to infinity. This implies that the density of ones in the entire Fibonacci word is also equal to $\varphi$.

Therefore, we can see the following formula:

$$\lim_{n \to \infty} D(n) = \lim_{n \to \infty} \left( \frac{F(n)}{F(n + 1)} \right).$$

This means that as $n$ gets larger and larger, the density of 1's in the first $n$ terms of the Fibonacci word approaches the golden ratio. In other words, the Fibonacci word has a density of 1's that is asymptotically
equal to the golden ratio $\varphi$.

The density of the symbol 0 in the Fibonacci word is also equal to the golden ratio, since the sequence is symmetric with respect to the two symbols. Therefore, the Fibonacci word has a uniform density of $\frac{1+\varphi}{2}$ for both 0's and 1's.

Therefore, we can conclude that the density of the Fibonacci word is equal to $\varphi - 1$. So we can write:

$$ \lim_{n \to \infty} D(n) = \lim_{n \to \infty} \left( \frac{F(n)}{F(n+1)} \right) = \varphi - 1. $$

We have:

$$ F(n) = \frac{\varphi^n - (1-\varphi)^n}{\sqrt{5}}, \quad F(n+1) = \frac{\varphi^{n+1} - (1-\varphi)^{n+1}}{\sqrt{5}} $$

Thus:

$$ F(n+1) = \frac{\varphi\varphi^n - (1-\varphi)(1-\varphi)^n}{\sqrt{5}} $$

So that, we have in figure 2 density for n=10 as example in many cases as in figure, so that:

$$ \frac{F(n)}{F(n+1)} = \frac{\frac{\varphi^n - (1-\varphi)^n}{\sqrt{5}}}{\frac{\varphi\varphi^n - (1-\varphi)(1-\varphi)^n}{\sqrt{5}}} = \frac{\varphi^n - (1-\varphi)^n}{\varphi\varphi^n - (1-\varphi)(1-\varphi)^n} $$

Therefore we notice that in the figure below as:

<figure><img src="image_4.png" /><figcaption>FIGURE 2. Density of Fibonacci word with Mathematica of length $n = 10$.</figcaption></figure>
Also, we have the figure 3 as:

$$ 
\begin{aligned}
\lim_{n \to \infty} \frac{F(n)}{F(n+1)} &= \\
& \lim_{n \to \infty} \frac{2 \left( \left( \frac{1}{2}(1 + \sqrt{5}) \right)^n - e^{n(\log(\varphi-1)+i\pi)}} \right)}{2^{-n}(1 + \sqrt{5})^{n+1} + (\sqrt{5}-1)e^{n(\log(\varphi-1)+i\pi)}} = \\
&= 0.618033\dots
\end{aligned}
$$

<figure><img src="image_5.png" /><figcaption>FIGURE 3. Cross section of Density of Fibonacci of length $n = 10$.</figcaption></figure>

Finally we have:

$$ \lim_{n \to \infty} \frac{F(n)}{F(n+1)} = \varphi - 1 \approx 0.618033 $$

Therefore $\lim_{n \to \infty} D(n) = \lim_{n \to \infty} \frac{F(n)}{F(n+1)}$ as $n$ approaches infinity is approximately $\varphi - 1 \approx 0.61803398874...$, which it's the golden ratio. $\square$

<figure><img src="image_6.png" /></figure>

**Remark 1.** We can more clearly express the graphs we referred in 2,3 to in the previous proof as follows: We extend Figure 3 to:
<figure><img src="image_7.png" /><figcaption>FIGURE 4. Extend Density of Fibonacci 3.</figcaption></figure>

Also, *Stretch Figure 4* to:

<figure><img src="image_8.png" /><figcaption>FIGURE 5. Hue of Density of Fibonacci of length $n = 10$.</figcaption></figure>

The Fibonacci word density can be generated from 3.4, and 3.7 by integrating as $\int_{a}^{b} f(x)dx$ where $a > b$ and $a, b \in \mathbb{N}$ in next lemma. We show that the integral represents an approximation derived from the calculation of the limit of the follower that we referred to in the previous theorem 3.7.

**Lemma 3.8**(). Let $b \ge 0$, and a function $f$ define as: $f: \mathbb{N} \rightarrow \mathbb{R}$, where $f(x) = e^{-x(1+1/\tau)}x^{k-1}$, then dense of Fibonacci words can be
generated as:

$$ \lim_{n \to \infty} D(n) = \lim_{n \to \infty} \int_a^b f(x) dx \quad \text{where } a > b \text{ and } a, b \in \mathbb{N} $$

where $D(n) = \int_a^b f(x) dx$ and $f(x) = e^{-x/\tau} g(x)$, and $g(x) = x^{k-1}e^{-x}$, for some appropriate choices of $a, b, k, \tau$, Thus, we have:

$$ \lim_{n \to \infty} D(n) = \lim_{n \to \infty} \int_a^b e^{-x(1+1/\tau)} x^{k-1} dx $$

*Proof.* by using Binet's formula from 3.4 we have: $F(n) = \frac{\varphi^n - (1-\varphi)^n}{\sqrt{5}}$, where $\varphi = \frac{1+\sqrt{5}}{2}$ is the golden ratio. we can express $D(n)$ as we refer in 3.7 as :

$$ D(n) = \frac{\varphi^n - (1 - \varphi)^n}{\varphi^{n+1} - (1 - \varphi)^{n+1}} $$

Thus, we get on the term $(1-\varphi)^n$ where $n \to \infty$ approaches zero because $|1-\varphi| < 1$. from 3.7, we can simplify with $a > b$ and $a, b \in \mathbb{N}$ then (see 5) we have:

$$ \lim_{n \to \infty} D(n) = \varphi - 1 \approx 0.61803398874... $$

by utilising the continuous analogues of Fibonacci numbers and their attributes. The limit converges to a golden ratio-related constant, which can be represented by integrals incorporating alternative continuous approximations of Fibonacci growth or exponential decay functions as:

$$ D(n) = \int_{a}^{b} f(x) \quad \text{then, } \lim_{n \to \infty} D(n) = \lim_{n \to \infty} \int_{a}^{b} e^{-x(1+1/\tau)} x^{k-1} dx $$

we have $a > b$, $\{a, b\} \in \mathbb{N}$, As long as this condition is fulfilled, by the properties of the Fibonacci word, we get the value in 3.7, While a specific integral formula may vary depending on context and application, it will generally reflect relationships between exponential functions and power laws that resemble the growth rates of Fibonacci numbers as $n \to \infty$. $\square$

**Lemma 3.9.** The ratio of consecutive Fibonacci numbers converges to the golden ratio:

$$ \lim_{n \to \infty} \frac{F(n)}{F(n-1)} = \varphi $$

*Proof.* we have: $\lim_{n \to \infty} D(n) = \varphi - 1$, the limit states that as $n$ approaches infinity, $D(n)$ approaches $\varphi - 1$, from 3.5 we have $\lim_{n \to \infty} F_n =$
$\infty$, we know from [2] $F(n) = F(n-1) + F(n-2)$, then we have:

$$D(n) = \frac{F(n)}{F(n+1)} = \frac{F(n)}{F(n) + F(n-1)}$$

As $n \to \infty$, we can consider the relationship between these ratios. Thus from 3.7 for any Fibonacci numbers we have :

$$\lim_{n \to \infty} \frac{F(n)}{F(n-1)} = \varphi$$

□

**Observation 3.10.** by using Lemma 3.8 and if we have: $\lim_{n \to \infty} D(n) = \lim_{n \to \infty} (\frac{F(n)}{F(n+1)}) = \varphi - 1$, then we can therefore make an assumption based on the properties of power series as follows:

$$D(n) \approx e^{-\sum_{k=1}^{n}(\varphi-1)}.$$

In fact, this is an approximation because $D(n) = \frac{F(n)}{F(n+1)}$, then $\lim_{n \to \infty} D(n) = \varphi - 1$, and we have $D(n) = e^{-\lim_{n \to \infty}(\varphi-1)n}$. However, since $D(n) \to \varphi - 1$, we need to adjust this to reflect the correct product form. So to express the limit of your sequence as a product, we can write: $D(n) = e^{-\sum_{k=1}^{n}(\varphi-1)}$. Thus, we conclude:

$$\lim_{n \to \infty} D(n) = e^{-\infty} = 0 \neq \varphi - 1$$

So that, this is an approximation. Thus, the assumption we have made is not correct assumption based on the integral we have presented, we can notice that in this figure beside on 3.7 as:

<figure><img src="image_9.png" /><figcaption>FIGURE 6. Density of Fibonacci word of length $n = 10$.</figcaption></figure>
3.2. Evaluate Fibonacci word density programmatic and dynamically. The density of Fibonacci word for the first one 100 digits by Python programming we can write the following:

```python
def fibonacci_word(n):
    if n == 0:
        return"
    elif n == 1:
        return "1"
    elif n == 2:
        return "10"
    else:
        return fibonacci_word(n-1) + fibonacci_word(n-2)
        fib_word = fibonacci_word(22)

# get the first 100 digits of the Fibonacci
num_ones = fib_word.count("1")
num zeros = fib_word.count("0")

import math
phi = (1 + math.sqrt(5)) / 2
def fibonacci(n):
    return int((phi**n - (1-phi)**n) / math.sqrt(5))
def limit_ratio(n):
    return fibonacci(n) / fibonacci(n+1)
# compute the limit of the ratio as n approaches infinity
n = 1000  # any large number can be used here
while True:
    ratio = limit_ratio(n)
    next_ratio = limit_ratio(n+1)
    if abs(ratio - next_ratio) < 1e-10:
        break
    n += 1
# print the result
print("for the first 100 digits:", fib_word)
print("Number of ones:", num_ones)
print("Number of zeros:", num zeros)
print("density = as n approaches infinity:")
print("{:.10f}", format(ratio))
```

The output of this program will be:

```
for the first 100 digits: 10110101101101011010110101101011...
Number of ones: 17711
Number of zeros: 10946
density = as n approaches infinity: 0.6180339887498...
```
we found in 2, density of Fibonacci word with Mathematica of length $n = 100$, in next figure we have the length for $n = 100$ as:

<figure><img src="image_10.png" /><figcaption>FIGURE 7. Density of Fibonacci word with length $n = 100$.</figcaption></figure>

We can see from the figure, which is the visualisation of the Fibonacci word density relationship, that as the length of the word increases as in this figure from 3 as:

<figure><img src="image_11.png" /><figcaption>FIGURE 8. Extend of length $n = 100$.</figcaption></figure>

the density decreases and this is what we found with us through lemma 3.10, where we got a limit equal to 0, which is an unacceptable value, and also in 3.5 we have a value equal to infinity, which is an unacceptable value because we are dealing with finite words and this
is what the graph shows us for a length equal to 10 and a length equal
to 100, we explain in next figure as:

<figure><img src="image_12.png" /><figcaption>FIGURE 9. Extend Density of Fibonacci 8 with
$n = 100$.</figcaption></figure>

Finally we have the Hue figure as:

<figure><img src="image_13.png" /><figcaption>FIGURE 10. Hue of Density of Fibonacci word with
$n = 100$.</figcaption></figure>

4. CATALEN NUMBERS IN DENSITY OF FIBONACCI WORD

Catalan numbers are a sequence composed of organic numbers that
have been used in a variety of combinatorial mathematics tasks. They
are best known for counting the number of valid parenthetical expressions, grid paths, and other structures. The sequence starts with one, two, five, fourteen, and so on. These numbers, which may be generated via recursive formulas, offer intriguing features and applications in a variety of mathematical disciplines.

Catalan numerals are employed to count valid brackets. For example, with n pairs of brackets, the nth Catalan number indicates the number of appropriate groupings (see [19]). They also appear in permutations and layouts, such as when counting specific permutations utilising Catalan number squares (see [20]). Given that Catalan numbers are most commonly linked with combinatorial problems, their use in other mathematical fields, such as algebraic geometry and number theory, demonstrates its variety and depth. This broad applicability emphasises the significance of Catalan numbers in both fundamental and applied mathematics. In [20] define catalen number as:

$$C_n = \frac{1}{n+1} \binom{2n}{n}$$

**Proposition 4.1.** Fibonacci word of catalen number has defined as:

$$F(C_n) = F(C_n - 1)F(C_n - 2).$$

where *fibonacci word of order* $n \ge 3$.

*Proof.* We have $\binom{2n}{n} = \frac{(2n)!}{(n!)^2}$ depend on proposition as $\binom{x}{y} = \binom{x}{x-y}$, then we have:

$$F(C_n) = F(\frac{1}{n+1} \cdot \frac{(2n)!}{(n!)^2} - 1)F(\frac{1}{n+1} \cdot \frac{(2n)!}{(n!)^2} - 2)$$

this will be correct for $n \ge 3$ so that we have for $\frac{1}{n+1} \cdot \frac{(2n)!}{(n!)^2} - 1$ following table as:

<table><caption>TABLE 2. Correct value of n</caption><thead><tr><th>n</th><th>1/(n+1)·((2n)!)/(n!)<sup>2</sup> - 1</th></tr></thead><tbody><tr><td>1</td><td>-1/2</td></tr><tr><td>2</td><td>-1/3</td></tr><tr><td>3</td><td>1/4</td></tr><tr><td>4</td><td>9/5</td></tr></tbody></table>

**Case 1:** Let be take: $\frac{1}{n+1} \cdot \frac{(2n)!}{(n!)^2} - 1$, in this case we can write it as:

$$\frac{\binom{2n}{n} - n^2 - 2n - 1}{(n+1)^2} = -\frac{\binom{2n}{n} + n^2 + 2n + 1}{(n+1)^2}$$
by using gamma function $\Gamma$ we can write:

$$ \frac{2^{2n}\Gamma(n + \frac{1}{2})}{\sqrt{\pi}(n + 1)^2\Gamma(n + 1)} - 1 = \frac{4^n\Gamma(n + \frac{1}{2})}{\sqrt{\pi}(n + 1)^2\Gamma(n + 1)} - 1 = \frac{2^{2n+1}(\frac{1}{2}(2n + 1))!}{\sqrt{\pi}(n + 1)^2(2n + 1)(n!)} - 1 $$

So that, we have:

$$ -\frac{\sqrt{\pi}(n + 1)^2(2n + 1)(n!) - 2^{2n+1}(\frac{1}{2}(2n + 1))!}{\sqrt{\pi}(n + 1)^2(2n + 1)(n!)} $$

**Case 2** Let be take $\frac{1}{n+1} \cdot \frac{(2n)!}{(n!)^2} - 2$, in this case we can write it immediately by using gamma function $\Gamma$ as:

$$ \frac{2^{2n}\Gamma(n + \frac{1}{2})}{\sqrt{\pi}\Gamma(n + 2)} - 2 = \frac{2^{2n}\Gamma(n + \frac{1}{2}) - 2\sqrt{\pi}\Gamma n + 2}{\sqrt{\pi}\Gamma(n + 2)} $$

So that, we have:

$$ \frac{-2\sqrt{\pi}(n + 1)(2n + 1)n! - 2^{2n+1}(\frac{1}{2}(2n + 1))!}{\sqrt{\pi}(n + 1)(2n + 1)n!} $$

Finally, we have:

$$ F(\frac{1}{n+1} \binom{2n}{n}) = F(-\frac{\sqrt{\pi}(n+1)^2(2n+1)(n!) - 2^{2n+1}(\frac{1}{2}(2n+1))!}{\sqrt{\pi}(n+1)^2(2n+1)(n!)})F(-\frac{2\sqrt{\pi}(n+1)(2n+1)n! - 2^{2n+1}(\frac{1}{2}(2n+1))!}{\sqrt{\pi}(n+1)(2n+1)n!}) $$

where $n \ge 3$. In fact, this is identical to the traditional definition of Fibonacci word- which is identical to Morse sequence - and is identical to the original definition of Fibonacci numbers.

As desire.

<figure><img src="image_14.png" /></figure>

**Theorem 4.2.** Let be $n \ge 1$ integer number, density of fibonacci word by using catalan number $C_n$ is:

$$ D(F(C_n)) = \lim_{n \to \infty} \frac{F(C_n + 1)}{F(C_n)} = 1. $$

*Proof.* In order to calculate the density, since we have expressed it as an increasing limit of 1, we need to use a Fibonacci term and let this term be a term imposed on this mathematical basis, that is, we express the Fibonacci term in the form of a mathematical term given by a specific formula depend on the theorem of density is: density of Fibonacci word a particular letter in the word using the following formula:

$$ \lim_{n \to \infty} D(n) = \lim_{n \to \infty} \left( \frac{F(n)}{F(n + 1)} \right) = \varphi - 1 $$
where $\phi$ is the golden ratio. Let be suppose the function is: $F(n) = \frac{(n+1)(n!)^2+(2n)!}{(2n)!}$, then we can rewrite the limit as:

$$L = \lim_{n \to \infty} \left( \frac{(n+1)(n!)^2}{(2n)!} + 1 \right).$$

Using the general definition of the factorial's function, which gives an approximation, we can write by using Stirling's such that $n! \sim \sqrt{2\pi n} \left(\frac{n}{e}\right)^n$, we can approximate $(2n)!$ as $(2n)! \sim \sqrt{4\pi n} \left(\frac{2n}{e}\right)^{2n}$. Then we have:

$$L = \lim_{n \to \infty} \left( \frac{(n+1)(\sqrt{2\pi n}(n/e)^n)^2}{\sqrt{4\pi n}(2n/e)^{2n}} + 1 \right) = \lim_{n \to \infty} \left( \frac{(n+1)(2\pi n)(n^2/e^{2n})}{\sqrt{4\pi n}(4^n n^{2n}/e^{2n})} + 1 \right).$$

Now, simplifying the fraction in figure 11 as:

<figure><img src="image_15.png" /><figcaption>FIGURE 11. The function $f(n)$ on domain $[0, 10]$.</figcaption></figure>

$$\lim_{n \to \infty} \left( \frac{(n+1)(2\pi n)}{\sqrt{4\pi n}(4^n)} + 1 \right) = \frac{(n+1)(2\pi n)}{\sqrt{4\pi n}(4^n)} = 0.$$

Thus, we find that:

$$\lim_{n \to \infty} \left( \frac{(n+1)(n!)^2 + (2n)!}{(2n)!} \right) = 1.$$

Thus, we have obtained the limit of the dependent variable that we assumed to be equal to 1. We can adopt this result to form our hypothesis to obtain the density of the Fibonacci word using Catalan numbers to be equal to 1, which is the desired value. □

<figure><img src="image_16.png" /></figure>
4.1. **Fuzzy of Fibonacci Word.** Applying fuzzy logic into this concept may imply incorporating ambiguity or degrees of membership in the strings formed. For example, we could design a fuzzy Fibonacci word by allowing specific characters to appear in varied degrees of frequency.

**Example:** Let's create a fuzzy version of the Fibonacci word by assigning fuzzy values to characters: **Define Characters with Fuzzy Membership:**

“a”couldhaveamembershipvalueof0.8(strongpresence).

“b”couldhaveamembershipvalueof0.5(moderatepresence).

**Constructing the Fuzzy Word:** Start with the base cases:

$$F(0) = \text{"b"}(0.5)$$

$$F(1) = \text{"a"}(0.8)$$

Construct further:

$$F(2) = \text{"ab"}(\text{combinememberships} : \min(0.5, 0.8))$$

$$F(3) = \text{"aba"}$$

$$F(4) = \text{"abaab"}$$

You can represent each word with its fuzzy membership values:

$$F(2) = (\text{"a"}, 0.8), (\text{"b"}, 0.5)$$

$$F(3) = (\text{"a"}, 0.8), (\text{"b"}, 0.5), (\text{"a"}, 0.8)$$

## 5. CONCLUSION

Combinatorics on words plays a crucial part in many branches of mathematics. the theory of infinite binary sequences called Sturmian words, is the most well-known of its branches and is intriguing in many ways.

We referred to a relationship for any word in all non-empty palindromic subwords and dispersed palindromic subwords.

The Fibonacci word deserves, is that its properties be studied further apart from its particular beauty, which is frequently used and has significance in the theory of words and combinatorial pattern matching, is the most well-known illustration of a Sturmian word.
The first n terms of the Fibonacci word have a density of 1's that approaches the golden ratio, which is

$$ \lim_{n \to \infty} D(n) = \lim_{n \to \infty} \left( \frac{F(n)}{F(n+1)} \right) = \varphi - 1 = 0.61803398875.. $$

This indicates that as the sequence increases, the ratio of 1's in the sequence approaches the golden ratio.

The number of subwords of length $n + 1$ increases by 1 for both letters, 0 and 1.

As a result, the density of both 0's and 1's in the Fibonacci word is $\frac{1+\varphi}{2}$.

By Python programming we write a program and founded the natural density for fibonacci word for the first one 100 digits and after that we drew the graph by Mathematica for n=10,100,..., In addition, we can extend the histogram in 10 to:

<figure><img src="image_17.png" /><figcaption>FIGURE 12. finally extend density of fibonacci word with length n = 10.</figcaption></figure>

Therefore we get on a clear overview of the density of the Fibonacci word for length $n = 10, 100$, and by programme to $\infty$.

In general, the Fibonacci word has received a great deal of attention due to its importance in discrete mathematics as well as its useful uses in computer graphics, theoretical physics, and molecular biology.
ACKNOWLEDGEMENTS

Thank you to prof. Alexei Kanel-Belov for their thoughtful feed-
back and consistent support throughout these years, which elevated
the methodological approaches in this work.

DECLARATIONS

* Conflict of interest/Competing interests: No Conflicts: “All authors declare that they have no conflicts of interest.”

* Ethics approval and consent to participate: This study did not require ethics approval as it did not involve human participants.

* Author contribution: All Authors Reviewed and Approved the Final Version of the Manuscript.

REFERENCES

[1] Rigo, M. (2014). Formal Languages, Automate and Numeration Systems 1: In-troduction to Combinatorics on Words, urldoi/book/10.1002/9781119008200.

[2] Glen, A. (2006). On Sturmian and episturmian words, and related top-ics. Bulletin of the Australian Mathematical Society, 74, 155 - 160., url-doi:10.1017/S0004972700047559

[3] Ramírez, J.L., & Rubiano, G.N. (2013). On the k-Fibonacci words. Acta Univeritatis Sapientiae, Informatica, 5, 212 - 226, urlDOI:10.2478/ausi-2014-0011

[4] Catarino, P. (2014). On Some Identities for k-Fibonacci Sequence. The International Journal of Contemporary Mathematical Sciences, 9, 37-42, url-https://doi.org/10.12988/IJCMS.2014.311120.

[5] Rigo, M., Stipulanti, M., & Whiteland, M.A. (2023). Gapped Binomial Complexities in Sequences. 2023 IEEE International Symposium on Information Theory (ISIT), 1294-1299, urldoi:10.1109/ISIT54713.2023.10206676.

[6] Bacon, M.R., Cook, C.K., Flórez, R., Higuita, R.A., Luca, F., & Ramírez, J.L. (2024). Fibonacci–Theodorus Spiral and its properties, url-https://doi.org/10.48550/arXiv.2407.07109.

[7] Lothaire, M. (1997). Combinatorics on Words. Cambridge University Press, urlhttps://doi.org/10.1017/CBO9780511566097.

[8] Grimm, Uwe, (2001). Improved bounds on the number of ternary square-free words. Journal of Integer Sequences, 4(2), article no. 01.2.7, url-https://doi.org/10.48550/arXiv.math/0105245.

[9] Brinkhuis, J. (1983). Nonrepetitive sequences on three symbols. The Quarterly Journal of Mathematics, Oxford, 34(2), 145-149, url-https://doi.org/10.1093/qmath/34.2.145.

[10] Zolotov, Boris, Zolotov, Boris. "Another Solution to the Thue Problem of Non-Repeating Words", arXiv preprint arXiv:1505.00019", (2015), url-https://doi.org/10.48550/arXiv.1505.00019.

[11] urlhttps://www.techbaz.org/algorithms/palindrome-sequences.php.

[12] urlhttps:// stackoverflow.com/ questions/57515296.
[13] X. Droubay, J. Justin, and G. Pirillo. Episturmian words and some constructions of de Luca and Rauzy. Theoretical Computer Science, 255(1):539–553, 2001.

[14] Mahalingam, K., & Pandoh, P. (2021). Counting scattered palindromes in a finite word. arXiv preprint arXiv:2108.02729, url: https://doi.org/10.48550/arXiv.2108.02729.

[15] Fici, G. (2015). Factorizations of the Fibonacci Infinite Word. Journal of Integer Sequences, 18(15.9.3), 47-53. Available at: url: https://cs.uwaterloo.ca/journals/JIS/VOL18/Fici/fici5.pdf.

[16] J. Berstel and J. Karhumäki, "Combinatorics on Words-A Tutorial", 2003, url: https://www-igm.univ-mlv.fr/berstel/Articles/2003TutorialCoWdec03.pdf.

[17] R. Kelly, The On-Line Encyclopedia of Integer Sequences. The OEIS Foundation Inc, 2012, url: https://link.springer.com/chapter/10.1007/978-3-540-73086-2_1.

[18] A. M. Dumaine, The Fibonacci Word fractal. hal-00367972, 2009, url: https://hal.science/hal-00367972/en/.

[19] Elena, Deza. (2024). 4. Catalan Numbers, urldoi: 10.1142/13840.

[20] Pudwell, L. (2024). Catalan Numbers and Permutations. Mathematics Magazine, 97(3), 279–283, url: https://doi.org/10.1080/0025570X.2024.2336423.

**Duaa Abdullah:** THE MOSCOW INSTITUTE OF PHYSICS AND TECHNOLOGY

Email address: abdulla.d@phystech.edu

**Jasem Hamoud:** THE MOSCOW INSTITUTE OF PHYSICS AND TECHNOLOGY

Email address: khamud@phystech.edu