Locally Convex Words and Permutations

We introduce some new classes of words and permutations characterized by the second difference condition $\pi(i-1) + \pi(i+1) - 2\pi(i) \leq k$, which we call the $k$-convexity condition. We demonstrate that for any sized alphabet and convexity parameter $k$, we may find a generating function which counts $k$-convex words of length $n$. We also determine a formula for the number of 0-convex words on any fixed-size alphabet for sufficiently large $n$ by exhibiting a connection to integer partitions. For permutations, we give an explicit solution in the case $k = 0$ and show that the number of 1-convex and 2-convex permutations of length $n$ are $\Theta(C_1^n)$ and $\Theta(C_2^n)$, respectively, and use the transfer matrix method to give tight bounds on the constants $C_1$ and $C_2$. We also providing generating functions similar to the the continued fraction generating functions studied by Odlyzko and Wilf in the"coins in a fountain"problem.


Introduction
In this paper we investigate permutations π ∈ S n and words (functions f : [n] → [p]) that obey the condition: ..., n − 1], respectively, where k ∈ Z n≥0 and [n] = {1, 2, ..., n}. We refer to these as locally convex permutations and words with respect to k, or k-convex permutations and words. These classes seem to be new and we are unable to find any reference to them.
The study of these permutations arises from a problem in a graduate course taught by Jamie Radcliffe and brought to our attention by Jessie Jamieson. Problem 1.1. Let σ ∈ S n . If, for all i ∈ [n − 1], we have: then σ is a slow riser. Let Slow n be the number of slow risers in S n . What is Slow n ? Slow n is 2 n−1 since for any slow riser σ of length n − 1, there are exactly two places in the one line notation for σ in which we can insert n to form a slow riser of length n; n may be inserted immediately after n − 1 or at the beginning of the permutation. This "extension" map is 1 to 2 as removing n from a valid permutation of length n gives us a valid permutation of length n − 1.
We can abstract the property given above by noticing that it could equivalently be stated that σ ∈ S n is a slow riser if the first differences of σ are bounded above by one. We can generalize this problem by selecting some value other than one (call it k) to work with, but the previous argument still works as long as we pick a suitable extension procedure, so we turn to second differences as defined below. We thank Bill Kay for suggesting this generalization.
First, we discuss locally convex words, for which in the case of k = 0, we give a combinatorial interpretation in terms of integer partitions. In addition, we give a derivation of the generating functions for locally convex words for any k. We then study the case of k-convex permutations. We solve the case for 0-convex permutations and derive asympotic estimates of the number of permutations for k equal to 1 and 2. We also give generating functions for the cases k = 1, 2. Further, we are interested in seeing whether or not a Marcus-Tardos type result holds for k-convex permutations, as we are able to show that this holds for the cases of k = 1 and k = 2.

Locally Convex Words
We wish to count functions f : [n] → [p] such that for i ∈ {2, ..., n − 1} we have for some k ∈ Z ≥0 . We say that such a function is locally convex with parameter k. Notice that convex is an appropriate word to use here, as this stipulates a bound on the growth of the first differences: such that f (1) = a and f (2) = b that also obey the convexity condition (2.1). We will determine the generating function: F (a, b) = n≥2 f n (a, b)x n and when all of these generating functions have been determined, we will simply sum them in order to find the generating function for all such functions. That is, G k,p = 1 + px + a,b∈ [p] F (a, b) We will now give a method of determining F (a, b) given some fixed p and k using the Transfer Matrix method, which is described in [10], Section 4.7. For a short description of the transfer matrix method as used for enumerating permutations, see [6]. For a slightly different approach, consider, for example, [11].
These functions are in bijection with sequences a 1 , ..., a n where a i = f (i), which we will discuss below. To begin, we claim that for n ≥ 3, we have: Given a 1 , ..., a n , we know that a 2 , ..., a n is unique and counted by f n−1 (a 2 , a 3 ). If a 1 , ..., a n−1 is a sequence such that a 1 = b, then we see that this sequence has a unique extension to a sequence beginning with a if and only if a + a 2 − 2a 1 ≤ k, or equivalently, a 2 ≤ k + 2a 1 − a. Then, summing over all possible a 2 , we find the relation above.
We now claim that To see this, we multiply by x n and sum over (2.2) for n ≥ 3. We have Reversing the order of summation on the right and changing the indexing, we find: Now note that [x 2 ]F (a, b) = 1 so we can add x 2 to both sides and conclude (2.2). Furthermore, note that we have p 2 such in p 2 unknowns. To show that it is possible to find a generating function, it will suffice to check that such equations have a unique solution. Note that we can rearrange the above equation as follows: For ease of notation, we order the F (a, b) lexicographically, i.e. F (a, b) < F (c, d) if a < c or a = c and b < d. Given this order, let F i be the ith ordered element.
Let A ij be the matrix described by the p 2 equations above, ordered using the aforementioned linear order. Note that the diagonal entries of A are either 1 or 1 − x and that the off diagonal entries are either 0 or are divisible by x. We wish to show that the coefficient of x 0 in the determinant of A is 1. Let q be the number of diagonal entries of A equal to 1 − x. Then, det(A) = σ∈Sn sgn(σ)a 1,σ(1) ...a 2,σ (2) = sgn(e)a 1,1 ...a n,n + σ∈Sn−{e} sgn(σ)a 1,σ(1) ...a + 2, σ(2) ] as det(A) is a unit. This means the above system of equations has a unique solution. To arrive at the correct generating function, one must then add back in permutations of length 1 and 0 that do not fit into the scheme above.
As an example we can calculate that Notice that the number of such permutations as n becomes large stays constant at the value of 21. Perhaps somewhat surprisingly, this is true for all values of p when k = 0; this is our next result.
where a(j) is the number of integer partitions of j.
Proof. We rewrite this sum as and see that h(m) can be interpreted as the cardinality of H m , which we define as the set of 0-convex words of a fixed length at least 2p − 1 on the alphabet [p] that attain a maximal value of m. Now given a word w ∈ H m , we will show that every element in H m is determined uniquely by an ordered pair {w 1 , w 2 } of integer partitions of m − w f and m − w for w f and w the first and last entries of w, respectively, with possible values between 1 and m, which would mean that h(m) = ( m−1 j=0 a(j)) 2 . Fix m ≤ p and let w 1 , w 2 be two integer partitions of m 1 , m 2 < m, respectively. Write w 1 as a sequence with elements corresponding to the parts of the integer partitions written in increasing order. Now construct the word pf , where for all i = 1, 2, . . . , length(w 1 ), The result is a 0-convex word of length at most m 1 whose first entry is m − m 1 ≥ 1; it is strongly increasing and 0-convex (the second difference condition is satisfied because the sequence of first differences is weakly decreasing while the entries themselves are increasing, by construction). Similarly write w 2 , the sequence of partial sums of the partition of m 2 , also in decreasing order, and form the word sf where Then sf is 0-convex and strongly decreasing, with final element m − m 2 . For c ≥ 0, form a 0-convex word of length 2p − 1 + c that attains a maximum value of m by appending 2p − 1 + c − length(pf ) − length(sf ) ≥ 2p − 1 + c − m 1 − m 2 ≥ c + 1 copies of m to pf and then further appending sf to the result. To show that the concatenation of these three 0-convex sequences is also 0-convex, we must check the boundaries between the subwords. Clearly 2m ≥ m + pf (length(w 1 )) and 2m ≥ m + sf (1); notice also that by the construction of the words pf and sf , the difference between the final two entries of pf is less than the difference between m and the final entry of pf , and because this sequence is increasing the second difference condition is satisfied. A similar argument holds for the transition between the m plateau and sf , so we conclude that this construction maps the pair {w 1 , w 2 } into (pf )m . . . m(sf ), a 0-convex word in H m .
Next, fix c ≥ 0 and let w be a word of length 2p − 1 + c that attains a maximum value of m (w ∈ H m ). We know due to the convexity condition that w may be written as some subset of a strictly increasing subword followed by a plateau consisting of the value m and finally by a strictly decreasing subword; this ensures that all appearances of m in w are consecutive. Further, we know that m appears at least once. We can then write w = (pf )M (sf ) where pf and sf are 0-convex, pf is strongly increasing, sf is strongly decreasing, and M is a string of m's of length 2p−1+c−length(pf )−length(sf ) ≤ c+1 < 0 (hence w attains its maximum). Then pf encodes a unique integer partition w 1 of m − pf (1); the partition is given by the first differences of the entries in pf and m − pf (length(w 1 )) (the fact that this sequence is monotone decreasing proves uniqueness). As a similar argument can be made for sf into the partition w 2 of m − sf (length(w 2 )), we can now map the words w =

Locally Convex Permutations
Definition 3.1. Let π be a permutation of length n (π : [n] → [n] is a bijection). We say that π is k-convex for a nonnegative integer k if it obeys the following: If the statement is true for k = 0, we call π perfectly convex, and if the statement is true for k = 2 (and, as a result, for k = 1 and k = 0), we say that π is strongly convex.
Throughout, we will write π in one line notation as π(1)π(2)π(3) . . . π(n). We are interested in enumerating the k-convex permutations of length n, which we define as f k (n). First we will establish a few elementary properties of permutation convexity. Techniques similar to ours for enumeration and estimating growth rates may be found in [1] and [3].
If π is a k-convex permutation of length n, then π R , the reverse of π in S n , is also k-convex.
Proof. This is true simply because π(i) = π R (n + 1 − i) for i ∈ [n], and so 2π . In particular, this shows that for all n > 1, f k (n) is even for all k. Proposition 3.3. Strongly convex permutations (and therefore perfectly convex permutations) avoid consecutive entries order-isomorphic to 213 or 312.
Proof. Suppose without loss of generality that, for some i, π(i) < π(i−1) < π(i+1) (ie. there exists a consecutive 213), then In particular, this gives 0-, 1-, and 2-convex permutations some nice structure. Notice that another way of phrasing this result is that strongly and perfectly convex permutations contain only substrings whose minima are located at either the beginning or the end of the substring. Further, we can say that 213 and 312 avoiding permutations consist of an increasing substring followed by a decreasing substring, giving strongly convex permutations a "mountain" shape. Ignoring the convexity condition, it is clear that these patterns are in bijection with 2-colorings of [n − 1]. To construct the bijection, color each integer in [n − 1] red or blue, then begin with the increasing substring of red integers. Append n, followed by the decreasing substring of blue integers to form a unique permutation.
This construction ignores convexity, yet all strongly convex permutations may be constructed uniquely in this fashion. Thus we have our first upper bound on the number of strongly convex permutations: (This is a strict inequality as clearly not all ascending-descending permutations are 2convex.) There are other ways to obtain this result. One requires use of the fact that a strongly convex permutation of length n inherits a strongly convex substring consisting of [n − 1]. In other words, if a permutation of length n − 1 is not strongly convex, there is no way to "fix" the permutation by inserting n. Let π : [n − 1] → [n − 1] be a permutation that is not strongly convex, so there is some i for which π(i − 1) + π(i + 1) − 2π(i) > 2. If one were to attempt to "fix" this permutation by extending π to π , a permutation of length n, it is clear that one must insert n next to π(i) in the one line notation to fix the convexity condition. This will not work, however, as replacing π(i − 1) or π(i + 1) with n will only worsen the convexity at this point. Now, given a strongly convex permutation π(1)π(2)π(3) . . . π(n), how might one build a permutation of length n + 1? The ascending-descending nature of the permutation dictates that if π(i) = n, it must be that either π(i − 1) = n − 1 or π(i + 1) = n − 1. For the same reason, it must be that the only possible positions in which we can place n + 1 to extend π to π and preserve strong convexity are immediately before and immediately after n. Actually, one of these placements is always available; π may always be extended to length n + 1 by placing n + 1 between n and n − 1. Doing this for each permutation, we attain the inequality This method of tracking growth preserves substrings by "building in the middle" of the permutation. A similar thing may be done by "building from the outside." We will discuss this method later. Note that the classes of 1-convex and 2-convex permutations are smaller than Av(213, 312), which itself is enumerated by 2 n−1 , as is known from the seminal paper of Simion and Schmidt [9].
We now give another result that will prove useful in enumerating strongly convex and perfectly convex permutations.
We assume now that π(1) = 1 and recall that since π R is also k-convex, it remains only to show that π(2) = 2 or π(2) = 3 or both π(n) = 2 and π(n − 1) = 3. Suppose π(2) > 3, then since π is 213 and 312 avoiding (mountain-shaped, as described earlier), we know the decreasing sequence at the end of the permutation ends with the substring 32. This proves the proposition.
With these facts in mind, enumerating perfectly convex permutations is rather straightforward.
Enumerating strongly convex permutations has proven much more difficult than the perfect case. We now give another method of tracking the growth of these permutations: by considering building "from the outside." and R(π) := (π(1) + 1)(π(2) + 1) . . . (π(n) + 1)(1) to be, respectively, the left and right descendants of π. If L(π) is k-convex, we say that π left descends, and similarly define what it means for a permutation to right descend.
Analogously, let W = W 1 W 2 . . . W n be a word of length n on the alphabet {L, R}, then W (π) is the composition W n (W n−1 (. . . (W 2 (W 1 (π))) . . .)). We say that τ is a descendant of π and π is an ancestor of τ if there exists some word W on {L, R} such that W (π) = τ . Proposition 3.9. Let k < 3. If π is a k-convex permutation of length n with π(1) = 1, then L R (π) is a k-convex permutation of length n − 1. Similarly, if π(n) = 1, then R R (π) is a k-convex permutation of length n − 1.
Hence every k-convex permutation beginning with one descends from another k-convex permutation. For example, the 1-convex permutation 123564 descends from 12453, and its reverse, 465321, descends from 35421, the reverse of the ancestor of the original permutation. This gives a mapping of strongly convex permutations of length n (which must begin or end with 1) onto the strongly convex permutations of length n − 1. Now consider this process in reverse; if π is k-convex for k ∈ {0, 1, 2} and π(2) − 2π(1) ≤ k, then L(π) is k-convex (π left descends), and similarly if π(n − 1) − 2π(n) ≤ k, then R(π) is k-convex (π right descends). Notice that for k = 1 or 2, every k-convex permutation π has either a k-convex right descendant or a k-convex left descendant, as we have shown previously that π must begin with 12, 13, or 23 or end with 21, 31, or 32, all of which satisfy the condition for a descendant to be k-convex.
The graph displayed here is half of the first seven generations of the full 1-convex tree showing descendants of 12; the other half begins with 21 and branches in the same manner except that each descendant is placed by its reverse.
1-convex descendant graph (full permutation and abbreviated by endpoints, seven generations) Using this method to count and track strongly convex permutations, we enumerate f k (n) for k ≤ 2, n ≤ 12.
n f 0 (n) f 1 (n) f 2 (n)  We say that two permutations π and τ are identically-descending with respect to k if d k (π, i) = d k (τ, i) for all i ∈ N. In this case, we write d k (π) = d k (τ ).
Notice that by this definition, every permutation is identically-descending to its reverse, as the reverse permutation of W (π) is W C (π R ), where W is formed from W by changing all L's to R's and all R's to L's. We generalize this in the following Lemma.
This concludes the proof that W π = W τ , and so π and τ are identically-descending.
We may now express many permutations by the same four-character abbreviation without losing any information about their descendants, choosing the smallest numbers possible for convenience. For example, whereas we previous abbreviated the permutations such as 123564 and 46785321 by 1264, we may now abbreviate these permutations, along with others, including 12354, 487654321, and 1235674, as 1234; all of these 2-convex permutations are identically-descending with respect to two. The ability to express the behavior of multiple permutations using the same abbreviation suggests that recursion may be an effective tool in attempting to enumerate. We previously displayed convex permutations as a directed tree with edges from permutations to their first descendants. We now display the diagram again, this time allowing for cycles and reducing each permutation to the "smallest" abbreviation possible:

1-convex identically-descending transition digraph
Let A be the (infinite) adjacency matrix for the 1-convex descendant graph. We know then that since A n ij is the number of walks of length n from the i th vertex to the j th and a 1-convex permutation of length n + 1 is determined uniquely by a walk of length n beginning at the vertex 12, we have The issue is that because the graph is infinite, so is the matrix. We can obtain a lower bound on the growth rate of the sequence by truncating the graph at the edge from 1267 to 1278 (and therefore the corresponding adjacency matrix) and calculating (I − Ax) −1 , which is formally equal to ∞ n=0 A n x n . Each cell in the resulting matrix will contain a generating function for the corresponding cell of A. As we are interested in the number of walks beginning at the vertex 12, represented by the first row and column of the adjacency matrix, we sum over the first row to obtain a generating function for half the number of walks of length n + 1. Using the first 22 rows and columns of the matrix (as pictured above), we obtain: We now have a rational generating function whose denominator has a unique minimal root r = 0.65149869151455837735 . . ., which, as described in [12, p. 171] gives us an asymptotic lower bound: To find an upper bound, consider the edge of the graph that goes from 1267 to 1278. Because clearly 1267 has more descendants than 1278, we can truncate the graph at 1267 and insert a loop from 1267 to itself. The adjacency matrix for this upper bound graph is the same as the one above, except that we must insert a 1 into the 22 nd row and column. Again, we obtain a rational generating function: F 1,+ also has a unique minimal root of s = 0.65145978572056851317 . . ., which gives the asymptotic upper bound: We can use the same procedure to estimate the asymptotic growth of f 2 (n). The digraph used in this case is slightly different: Similarly, here we will find a lower bound on the growth rate by truncating the graph at the edge between 1278 and 1289, and find an upper bound by creating a loop from 1278 to itself, using the resulting matrices to find generating functions for the cells in the first row: also has a unique minimal root of t = 0.55979335021175578170 . . ., which gives the asymptotic upper bound: And, Corollary 3.13. For k = 1 and k = 2, the growth rate of f k (n) approaches some finite limit.
Proof. To see this, note that we can construct a sequence of larger transfer matrices and find a decreasing sequence (a i ) of upper bounding growth rates as well as an increasing sequence of lower bounding growth rates (b i ) along the path with vertices labeled 12c(c + 1). As both of these sequences have the same combinatorial interpretation in the limit they approach the same value, and so we see that we can use the squeeze theorem to find that the limiting growth rate exists.
Remark 3.14. It is also easy to prove the above corollary using subadditivity techniques as in Arratia [2]. We have that for k = 1, 2, f k (m + n) ≤ f k (m)f k (n) since a mountain shaped k-convex permutation π on [m + n] may be uniquely separated out into mountain shaped k-convex permutations on [m] and [n]. This may be done by first taking the subsequence of π consisting of the numbers [m], call this τ . To find the second sequence, we then take the remaining n entries of π and subtract m from each entry, call this ρ. For example: 1246753 may be separated for m = 3 and n = 4 into τ = 123 and ρ = 4675. It is easy to see that ρ will always be a k-convex permutation of length n by its inclusion in π. So, we need only check that τ itself is actually such a permutation. However, this is clear, as we have seen that deleting the peak of a k-convex permutation gives a k-convex permutation of a smaller length. So, we may delete each entry of ρ from π in decreasing order to reach τ , at which point we see that it is a k-convex permutation of length [m].
Taking logarithms, this shows that and so, by Fekete's lemma we have that which gives us the fact (since the exponential function is continuous) that lim f 1/n k (n) exists, as asserted.
In fact, for any k ≥ 3, we see that π is k-convex only if it avoids, consecutively, a set A k of permutations.
It is an open question as to what the minimum cardinality of A k is. Already, we have seen that |A 1 | = |A 2 | = 2. It would be interesting to determine whether our local k-convexity condition is strong enough to allow for us to make the following Stanley-Wilf conjecture type claim: If it can be shown that our local property implies that a k-convex permutation avoids a non-barred permutation class, then we could apply the Marcus-Tardos theorem [7] to conclude that f k (n) ≤ C n k for some 1 < C k < ∞.

A Generating Function for k=1
In this section, we find the generating function Note that while we can show that the limit for the growth constant exists and we can produce arbitrarily tight bounds for the limit by using larger matrices, we are still unable to 1223 1234 1245 1256 ... enumerate these permutations exactly. We will simplify a connected piece of the transition digraph, find sufficient information about that piece in order to analyze it, and then use that information in the transition matrix to finish our analysis. From the 1-convex transition digraph, we see that the nodes that are descended from successive left descendants of 123 are essentially isolated along a path in the graph. We refer to the node 123 as 1223 throughout this section as it simplifies our notation.
To see this, consider a permutation σ of the form 12(l)(l + 1), where l ≥ 3. Note that if this permutation right descends, then the resulting permutation, R(σ) = 23(l + 2)1, will not right descend for l − 1 generations, and after successive left descents we have L l−1 R(σ) = 12(l + 2 + (l − 1))l. This permutation left descends and right descends and thus by Theorem 3.12 is identically-descending with 12(l − 1)l. Note that as l ≥ 3, the first two entries of the successive left descents of R(σ) eventually take the form 12.
Using this information, we consider the vertex induced subgraph, T , induced in the transfer digraph for k = 1 by the nodes {12(k)(k + 1) : k ≥ 2}. We adopt the convention that an edge labeled with a natural number, k, represents a path on k edges from the tail to head of the labeled edge. By the above observations, we see that T has the form illustrated in the figure.
We now wish to count walks in T starting from the node 1234 and ending at 1234.
Proof. Let T k be the vertex induced subgraph of G induced by the vertices {12(l + 1)(l + 2) : l ≥ k}. Now let H k (q) be the generating function for the number of walks from 12(k+2)(k+3) to itself counted by length. So, we see that H 1 (q) = bot(q). Now, note that any walk from 1223 to itself is either the empty walk, or its first step is from 1223 to 1234 and its last three steps return the walk from 1234 to 1223. Between those steps, the walk consists of a walk beginning at 1234 and returning to 1234, we know these walks are counted by H 2 (q). So, from the above considerations we have: Similarly, by starting our walk in T k and performing the same argument with slight adjustment for the changed path length we see that Then by repeatedly substituting the values we found in 4.2, we are able to solve for 4.1.
The approach used here to find the generating function is similar to that introduced by Flajolet in [4] as we can associate each walk in our graph with a word in the alphabet a k , b k described in the paper and then evaluate a k as q and b k as q (k+2) . More generally, we see that this follows by the choice to view any Motzkin path with particular weightings of steps as a walk in a digraph. Further, note that this generating function is quite similar to the generating function for the number of fountains, which has been studied in [5] and [8].
We also wish to find the generating function for the number of walks in T beginning at 1223 counted by length, tot(q), as we will need this later.
Proof. The proof of the above is similar to that of Proposition 4.1. Consider the number of walks that end at the first vertex, 1223; there are H 1 (q) of these. Now consider walks ending at 1234; each of these is an extension of a walk ending at 1223, and it takes 1 step to reach this vertex, so there are qH 1 (q)H 2 (q) such walks. Next, we note that the number of walks ending at each point along the path back to 1223 from 1234 is then qH 1 (q)H 2 (q)(1 + q + q 2 ). We can repeat these observations for each node in the graph and thus arrive at the generating function above.
We now will use the transfer matrix method to find the generating function. To do so, we will integrate what we have learned about T into the transfer matrix framework. Note the following: whenever we consider a walk in the graph that reaches the node 1223, the walk will then branch into other, longer walks staying in T or returning to 1223 before reentering the bottom of the graph. By "bottom" we mean all vertices not descended from a left descendant of 1223, or in other words, the vertices not in T . Instead of keeping track of walks in the upper part of the graph individually, we can use a generating function. To do this consider a walk of length n that ends on 1223; this corresponds to a permutation of length n + 1. We now wish to determine the number of successive descendants of this permutation, or equivalently the number of walks in the graph beginning this way. The walk will either leave 1223 immediately or continue into T . If the walk continues into T , then we must keep track of how many walks exist in T after k steps. If it were impossible to leave T , we would be done and could simply keep track of how many walks there are in T starting at 1223. However, a walk in T may return to 1223 after some amount of time, at which point the walk branches and leaves T , as well as continuing back up into T . If we know how many walks of l steps in T begin and end at 1223, we can then anticipate these walks leaving T after a certain number of steps. We already have generating functions for both of these quantities, tot(q) and bot(q); tot(q) counts how many walks of length n stay in T if one walk ends at 1223, and bot(q) counts how many walks in T beginning at 1223 return to 1223 after so many steps. Thus we see that tot(q) − bot(q) has for its nth coefficient the number of walks in T of length n beginning at 1223 but not ending at 1223.
To incorporate this into our transfer matrix framework, we must count both the number of walks in T that will begin at 1223 after so many steps in addition to the number of walks that do not begin at 1223 but remain entirely in T . For the number of walks that do begin at 1223, we can use the generating function bot(q), as this counts the number of walks that begin and end at 1234 and are entirely in T . As bot(q) counts walks by length, we weight the edge between 1223 and 1432 by bot(q) instead of 1 in our transfer matrix. Each time a walk reaches 1223, we will anticipate the future walks that begin at 1223, but because those walks are n steps in the future, they carry a coefficient of q n . Similarly, we wish to count those walks that stay entirely in T . We noted before that tot(q) − bot(q) counts these walks, and since they have been counted previously these permutations will not have any descendants in our transition digraph. Instead of having an edge from 1223 to 1234 in our transition digraph, we will have an edge to a new node sink, which has no outgoing edges. We will weight the edge to sink by tot(q) − bot(q) and thus have tot(q) − bot(q) as the corresponding entry in our transfer matrix. Whenever a walk reaches 1223, exactly two edges will be traversed. One edge returns into the digraph with a weighting reflecting future walks that would be coming from T . The other edge goes to a sink and thus records the number of walks that stay entirely within T . Now when we consider Aq n all of the q coefficients of tot(q) and bot(q) simply tell us how many steps in the future a particular walk would take from T , even if we did not actually have the steps for that particular walk in the graph.
With the above observations, we can use the following transition matrix to keep track of the number of walks: Then by recalling that (I − M 1 q) −1 = n≥0 M n q n , we can invert this matrix in Mathematica and sum the first column (as done for finding the approximate growth rates earlier) to find the generating function. Similarly, this generating function only counts half of the walks of length 2 or greater, so we double it and multiply by q 2 to obtain the final generating function: (4.5) F 1 (q) = 1 + q − 2q 2 1 + bot(q)q 2 + tot(q)q −1 + q + bot(q)q 3 .

Generating Function for k = 2
We would now like to repeat the developments of the above section for when k = 2. We can do this with another transfer matrix and an explicit solution for walks in the corresponding infinite subgraph, which in this case consists of the descendants of the left descendants of 1234 in the graph for k = 2. The subgraph of interest in this case has structure similar to that from the k = 1 case, except now the edges that right descend return to nodes two levels below rather than one level below. We now need to keep track of the number of walks in the upper graph ending on 1245 as well as those ending on 1256, as each of these leads back into the original graph. Due to the more complicated structure of this graph we are unable to provide a simple generating function for the number of walks it contains, but if we define tot (q), bot 1 (q) and bot 2 (q) where bot 1 (q) counts walks ending on 1245 and bot 2 (q) counts walks ending on 1256 in the upper part of the graph, then we see that the generating function is: 1 + q − 2q 2 1 + q + q 2 + q 4 (1 + bot 2 (q)) + q 3 (1 + tot(q)) −1 + q + q 2 + q 4 − q 7 bot 2 (q) + q 5 (bot 1 (q) + bot 2 (q)) − q 6 (bot 1 (q) + bot 2 (q)) To make use of this formula, one may manually compute the values for the generating functions that it contains. Note that solving tot (q), bot 1 (q) and bot 2 (q) are not part of the framework of [4] as they are not easily encoded as words over a simple alphabet.

Future Work
There are many questions that remain to be answered about locally convex permutations and words. A natural goal is to find methods of enumerating these permutations for k ≥ 3, which is more difficult as the permutations can no longer be constructed in such a regular way.
Another question is, does there exist an algebraic generating function for k = 2? For larger k? Furthermore, can our Conjecture 3.15 be proven, or is there a counterexample for sufficiently large k?