Enumeration of Restricted Words and Linear Recurrence Equations
Milan Janjic

TL;DR
This paper explores the enumeration of restricted words over finite alphabets, deriving explicit formulas for related functions and connecting these to well-known sequences like Fibonacci and Tribonacci, while also solving linear recurrence equations.
Contribution
It introduces a reverse approach to enumerate restricted words by identifying initial functions that generate known sequences and derives explicit formulas for these functions and related recurrence solutions.
Findings
Explicit formulas for functions $f_m$ and $c_m$ for five types of restricted words.
Connections between these functions and classical sequences like Fibonacci, Mersenne, Pell, etc.
Combinatorial derivations of solutions to linear recurrence equations.
Abstract
In previous papers, for an arithmetical function , we defined functions and and designated numbers of restricted words over a finite alphabet counted by these functions. In this paper, we examine the reverse problem for five specific types of restricted words. Namely, we find the initial function such that and enumerate these words. In each case, we derive explicit formulas for and . Fibonacci, Merssen, Pell, Jacosthal, Tribonacci, and Padovan numbers all appear as values of , so we obtain new formulas for these numbers. Also, we combinatorially derive explicit formulas for the solutions of five types of homogenous linear recurrence equations.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Combinatorial Mathematics · semigroups and automata theory · Advanced Algebra and Logic
Enumeration of Restricted Words and Linear Recurrence Equations
Milan Janjić
Abstract.
In previous papers, for an arithmetical function , we defined functions and and designated numbers of restricted words over a finite alphabet counted by these functions. In this paper, we examine the reverse problem for five specific types of restricted words. Namely, we find the initial function such that and enumerate these words. In each case, we derive explicit formulas for and .
Fibonacci, Merssen, Pell, Jacosthal, Tribonacci, and Padovan numbers all appear as values of , so we obtain new formulas for these numbers. Also, we combinatorially derive explicit formulas for the solutions of five types of homogenous linear recurrence equations.
Department for Mathematics and Informatics, University of Banja Luka,
Republic of Srpska, BA
1. Introduction
This paper is a continuation of the investigations of the problem of restricted words enumeration from the author’s previous papers [2, 3, 4], where two functions and were defined as follows. For an initial arithmetic function , the function is the invert transform of . The function was defined as
[TABLE]
where the sum is over positive . For , the following formula holds:
[TABLE]
The functions and depend only on the initial function , and are related to the enumeration of weighted compositions. Namely, if weights are , then is the number of all weighted compositions of , and is the number of weighted compositions of into parts.
In Janjić [2, 3, 4], weighted compositions were related to restricted words over a finite alphabet. For a given initial function , we investigated restricted words counted by and . In this paper, we reverse the problem. Namely, for a particular type of restricted words, we first find the initial function which count such words. We then derive formulas for and and give its combinatorial meanings in terms of restricted words.
We restate [4, Propositions 12], which will be used frequently in the paper.
Proposition 1**.**
Assume that and . Assume next that, for , we have words of length over a finite alphabet . Let be a letter which is not in . Then, is the number of words of length over the alphabet in which appears exactly times.
We also restate the result in [4, Proposition 6]. The following formula holds:
[TABLE]
We consider the following five types of restricted words:
Words over the alphabet , such that no two adjacent letters from are the same.
- 2.
Words over the alphabet such that letters avoid a run of odd length.
- 3.
Words over the alphabet avoiding subwords of the form .
- 4.
Words over the alphabet such that [math] and appear only as subwords of the form , where is a run of zeros of length at least .
- 5.
Words over the alphabet in which [math] appears only in a run of even length, and appears only in a run the length of which is divisible by .
We note that the initial function is defined by a linear homogenous recurrence in all cases.
2. Case 1
To solve the problem posed in Case 1, we consider the following linear recurrence:
[TABLE]
where . It is easy to see that
[TABLE]
Remark 1**.**
This formula appears in Birmajer at al. [1, Example 17]. Also, the case is considered in [4, Example 18].
The function has the following combinatorial interpretation:
Proposition 2**.**
The number is the number of words of length over the alphabet such that no two adjacent letters are the same.
Proof.
We have , since only the empty word has length [math]. Also, , since a word of length may consist of an arbitrary letter. To obtain a word of length , for , we need to insert letters in front of each word of length . ∎
As an immediate consequence of Janjić [2, Corollary 9], we obtain
Corollary 1**.**
For , the following recurrence holds:
[TABLE]
We next prove that counts the desired words.
Proposition 3**.**
The number is the number of words of length over the alphabet , such that no two adjacent letters from are the same.
Proof.
We have , since only the empty word has length [math]. Also, since a word of length may consist of any letter of the alphabet. Assume that . Consider a word of length . In front of such a word, we insert a letter different from the first letter of the word. In this way, we obtain all words of length beginning with two different letters. The remaining words must begin with two same letters. Since there are such words, the statement is true. ∎
Remark 2**.**
The continued fraction equals . Also, the sequence is the numerator of the th convergent of .
Since , we may apply Proposition 1 to obtain
Corollary 2**.**
The number is the number of words of length over in which letters equal , and no two letters from are identical.
We next derive an explicit formula for .
Proposition 4**.**
We have
[TABLE]
Proof.
From (1), we firstly obtain . Assume that . Since at most of may equal , then
[TABLE]
∎
Remark 3**.**
Note that, in (4), terms in which would equal zero.
To obtain an explicit formula for , we use (3). We first extract the term for to obtain
[TABLE]
It follows that
[TABLE]
Using (2), we obtain the following formula for :
[TABLE]
3. Case 2
Let be a positive integer. Define as follows:
[TABLE]
We firstly describe the restricted words counted by .
Proposition 5**.**
For , the number is the number of words of length over the alphabet in which there are no runs of odd length.
Proof.
Let denote the number of words of length , which we wish to count. Firstly, since only the empty word has length [math]. Next, as there are no runs of length . Assume that . A word of length must begin with two identical letters. Hence, there are such words. We conclude that the following recurrence holds:
[TABLE]
which yields . ∎
From (5), we easily obtain the following explicit formula for :
[TABLE]
Corollary 3**.**
For , the following recurrence holds:
[TABLE]
Proof.
The proof is a consequence of [2, Corollary 9]. ∎
Proposition 6**.**
The number is the number of words of length over the alphabet , such that letters avoid runs of odd length.
Proof.
We let denote the number of desired words of length . It is clear that and . A word of length may begin with a letter from . There are such word. If a word begins with a letter from , it must be followed by the same letter. Hence, there are such words. We conclude that . ∎
Some well-known classes of numbers satisfy the recurrence from Corollary 3. We give the appropriate combinatorial meaning for some of them.
- (1)
The case concerns the Fibonacci numbers. The number of binary words of length in which [math] avoids a run of odd length is . 2. (2)
The case concerns the Pell numbers . The number of ternary words of length in which [math] avoids runs of odd length is . 3. (3)
The case concerns the Jacobhstal numbers . The number of ternary words of length in which [math] and avoid runs of odd length is .
From the combinatorial interpretation, we easily derive an explicit formula for .
Proposition 7**.**
We have
[TABLE]
Proof.
According to Proposition 6, in a word counted by , the letters from may appear only in pairs. There are such pairs. We may choose pairs in a word of length . These pairs may be chosen in ways. When we have chosen pairs from , the remaining letters are from , which are in number. ∎
As a consequence, we obtain the following similar explicit formulas for the Fibonacci, Pell and Jacobsthal numbers:
[TABLE]
Corollary 4**.**
The number is the number of words of length over the alphabet in which the letter appears times, and letters from avoid runs of odd length.
Proof.
The proof follows from Proposition 1. ∎
We now derive an explicit formula for .
Proposition 8**.**
The following equation holds:
[TABLE]
Proof.
Each term in (1) in which is even equals zero. Hence, (1) becomes
[TABLE]
∎
As a consequence of (2), we obtain the following explicit formulas for the Fibonacci and Jacobsthal numbers:
[TABLE]
Furthermore, we derive an explicit formula for . Using (3), for even , we obtain
[TABLE]
For odd , we have
[TABLE]
In particular, for , we obtain the following formulas for Pell numbers:
[TABLE]
Remark 4**.**
Using (3), we may obtain an explicit formula for .
4. Case 3
Let be integers. We define by the following recurrence:
[TABLE]
Proposition 9**.**
The number is the number of words of length over the alphabet , avoiding subwords .
Proof.
We let denote the number of the words of length . Firstly, , since only the empty word has length [math]. Next, , since there are no restrictions on words of length . Assume that . A word of length may begin with any letter. We have such words. From this number, we must subtract words which begin with subwords . Hence, satisfies the same recurrence as , and the proposition is proved. ∎
Example 1**.**
- (1)
If , we have
[TABLE]
which yields that . Hence, is the number of binary words of length avoiding subword . 2. (2)
If , we have
[TABLE]
which is a well-known recurrence for the Fibonacci numbers . Hence, is the number of ternary words of length avoiding subword .
We now consider the particular case .
Corollary 5**.**
If and , then
[TABLE]
Proof.
We have . Further,
[TABLE]
On the other hand, we have
[TABLE]
∎
In particular, for , we have , which yields
Corollary 6**.**
The Mersenne number is the number of ternary words of length avoiding and .
Using [2, Corollary 9], we obtain
[TABLE]
This means that counts the same sort of words as , with instead of .
Using Proposition 1, we obtain the following combinatorial interpretation of .
Corollary 7**.**
The number is the number of words of length over the alphabet having exactly letters equal and avoiding subwords .
We next derive an explicit formula for . A generating function for the sequence is . According to [4, Equation (1)], we have
[TABLE]
The numbers and are the solutions of the equation .
Proposition 10**.**
We have
[TABLE]
Proof.
We expand into powers of . Since
[TABLE]
we easily obtain
[TABLE]
and the statement follows by replacing by . ∎
In the case , we have and . Therefore, the following formula holds:
[TABLE]
Using (1), we obtain
Identity 1**.**
[TABLE]
where .
Remark 5**.**
Using (3) and (2), we obtain explicit formulas for and .
5. Case 4
We let denote the condition given in this case. We first solve the problem for binary words.
Proposition 11**.**
Let be the number of binary words satisfying . Then,
- (1)
2. (2)
For , we have .
Proof.
- (1)
We have , since the empty word has length [math]. Next, , since no words of length satisfy . Also, , since is the only word of length satisfying . Next, , since is the only word of length satisfying . Assume that . Then,
[TABLE]
since a word of length greater than must begin with a subword of the form . Analogously, we obtain
[TABLE]
Comparing these two equations, we get
[TABLE] 2. (2)
The formula follows from the preceding recurrence.
∎
Since , and so , using Proposition 1 and (2), we obtain the following combinatorial interpretations of and .
Corollary 8**.**
- (1)
The number is the number of words over the alphabet of length having letters equal and satisfying . 2. (2)
The number is the number of words of length over the alphabet satisfying .
We next derive an explicit formula for . It is known that is the coefficient of in the expansion of into powers of .
We consider the following auxillary initial function:
[TABLE]
From [2, Proposition 23], we obtain . It is proved in [3, Proposition 13] that
[TABLE]
and otherwise.
Using [4, Proposition 6] yields
[TABLE]
Hence,
[TABLE]
We let denote . We have to expand the expression which we denote by . It follows that . Hence,
[TABLE]
Using (9) yields
[TABLE]
It is easy to see that, in the case , the coefficient of on the right-hand side of this equation equals . We thus obtain
Proposition 12**.**
The following equations hold:
[TABLE]
Using [2, Corollary 9], we easily obtain the following recurrence for :
[TABLE]
Some particular cases are of note. In the case , we obtain
[TABLE]
which implies
[TABLE]
We thus obtain the following property of powers of .
Corollary 9**.**
For , the number is the number of ternary words of length satisfying .
It yields that the following Euler-type identity holds:
Identity 2**.**
For , the number of binary words of length is the number of ternary words of length , in which [math] and appear only in a run of the form , where is the run of zeros of length .
From Propositions 12 and (2), we obtain the following identity for the Mersen numbers:
Identity 3**.**
[TABLE]
We now consider the second particular case . We have
[TABLE]
which is the recurrence for Fibonacci numbers . We thus have
Corollary 10**.**
The Fibonacci number is the number of quaternary words of length satisfying .
Calculating values for , we obtain
Identity 4**.**
[TABLE]
Remark 6**.**
Using (3) and (2), we obtain the explicit formulas for and .
6. Case 5
We let denote the given condition. Again, we first consider the binary words.
Proposition 13**.**
- (1)
The following formula holds:
[TABLE] 2. (2)
We have , where is the th Padovan number.
Proof.
The first statement is easy to prove. Since is essentially the recurrence for the Padovan numbers, the statement is true. ∎
This means that the Padovan number is the number of binary words of length in which [math] appears in runs of even length, while appears in runs, the lengths of which are divisible by . This means that the Padovan numbers count the compositions into parts and , which is a well-known.
Corollary 11**.**
- (1)
The function satisfies the following recurrence:
[TABLE] 2. (2)
Then, is the number of words of length over satisfying . 3. (3)
Also, is the number of words of length over having letters equal to , and satisfying .
Proof.
The claim easily follows from [2, Theorem 6]. The claims and follow from Proposition 1.
We add a short combinatorial proof for . Equation means that the empty word satisfies . Further, means that a word of length may consist of any letter except [math] and . Next, means that a word of length may consist of pairs from , which are in number, plus the word . Finally, a word of length may begin with any letter from , or from , or from . ∎
The case in Corollary 11 is the recurrence for Tribonacci numbers. Hence,
Corollary 12**.**
The sequence of the Tribonacci numbers is the invert transform of the sequence of the Padovan numbers.
Also, Tribonacci numbers count ternary words satisfying .
Finally, we calculate . We define the arithmetic function such that , and otherwise. It follows from [3, Propositon 5] that Also, using [2, Theorem 6], we obtain
[TABLE]
This implies that . The sequence is thus obtained by inserting at the beginning of the sequence .
Using [4, Equation (10)], we obtain
[TABLE]
On the other hand, [4, Proposition 2] yields
[TABLE]
To obtain an explicit formula for , we need to expand the expression given by into powers of . We have
[TABLE]
where . Hence,
[TABLE]
Applying Equation(10) yields
[TABLE]
Taking , we get
Proposition 14**.**
The following formula holds:
[TABLE]
We thus obtain the following identity for the Tribonacci numbers :
Identity 5**.**
[TABLE]
Remark 7**.**
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] D. Birmajer, J. B. Gil, and M. D. Weiner, On the enumeration of restricted words over a finite alphabet J. Integer Seq. 19 (2016),
- 2[2] M. Janjić, On linear recurrence equation arising from compositions of positive integers J. Integer Seq. 18 (2015), Article 15.4.7.
- 3[3] M. Janjić, Binomial coefficients and enumeration of restricted words J. Integer Seq. 19 (2016), Article 16.7.3
- 4[4] M. Janjić, Some formulas for numbers of restricted words, preprint, 2017, http://arxiv.org/abs/1702.01273
