Upper Bounds for Stern's Diatomic Sequence and Related Sequences

Let $(s_2(n))_{n=0}^\infty$ denote Stern's diatomic sequence. For $n\geq 2$, we may view $s_2(n)$ as the number of partitions of $n-1$ into powers of $2$ with each part occurring at most twice. More generally, for integers $b,n\geq 2$, let $s_b(n)$ denote the number of partitions of $n-1$ into powers of $b$ with each part occurring at most $b$ times. Using this combinatorial interpretation of the sequences $s_b(n)$, we use the transfer-matrix method to develop a means of calculating $s_b(n)$ for certain values of $n$. This then allows us to derive upper bounds for $s_b(n)$ for certain values of $n$. In the special case $b=2$, our bounds improve upon the current upper bounds for the Stern sequence. In addition, we are able to prove that $\displaystyle{\limsup_{n\rightarrow\infty}\frac{s_b(n)}{n^{\log_b\phi}}=\frac{(b^2-1)^{\log_b\phi}}{\sqrt 5}}$.


Introduction
Throughout this paper, F m and L m will denote the Fibonacci and the Lucas numbers. We have F m+2 = F m+1 +F m and L m+2 = L m+1 +L m for all integers m (including negative integers). We convene to use the initial values F 1 = F 2 = 1, L 1 = 1, and L 2 = 3. We also let φ = 1 + √ 5 2 and φ = 1 − √ The symbol N will denote the set of positive integers.
Problem B1 of the 2014 William Lowell Putnam Competition defines a base 10 over-expansion of a positive integer N to be an expression of the form N = d k 10 k + d k−1 10 k−1 + · · · + d 0 10 0 with d k = 0 and d i ∈ {0, 1, 2, . . . , 10} for all i. We may generalize (and slightly modify) this notion to obtain the following definition. The Stern-Brocot sequence, also known as Stern's diatomic sequence or simply Stern's sequence, is defined by the simple recurrence relations s(2n) = s(n) and s(2n + 1) = s(n) + s(n + 1) for all nonnegative integers n, where s(0) = 0. This sequence has found numerous applications in number theory and combinatorics, and it has several interesting properties which relate it to the Fibonacci sequence. For n ≥ 2, it is well-known that s(n) is the number of base 2 over-expansions (also known as hyperbinary expansions) of n − 1 [3]. To generalize Stern's sequence, let s b (n) denote the number of base b over-expansions of n − 1. Equivalently, one may wish to think of s b (n) as the number of partitions of n − 1 into powers of b with each part occurring at most b times. We convene to let s b (0) = 0 and s b (1) = 1. The sequence s b (n) satisfies the recurrence relations s b (bn) = s b (n), s b (bn + 1) = s b (n) + s b (n + 1), and s b (bn + i) = s b (n + 1) for i ∈ {2, 3, . . . , b − 1}. Equivalently, if n ≡ i (mod b) and 2 ≤ i < b. (1) Using (1), one may easily prove the following lemma.
Lemma 1.1. Let n be a positive integer. If n ≡ 1 (mod b 2 ), then If n ≡ b + 1 (mod b 2 ), then Calkin and Wilf [2] determined that 0.958854... = 3 log 2 φ √ 5 ≤ lim sup n→∞ s(n) n log 2 φ ≤ 1 + φ 2 = 1.170820..., and they asked for the exact value of lim sup s(n) n log 2 φ . Here, we give upper bounds for the values of s b (n) for any integer b ≥ 2, from which we will deduce that lim sup In particular, lim sup n→∞ s(n) n log 2 φ = 3 log 2 φ √ 5 . While preparing this manuscript, the author discovered that Coons and Tyler [4] had already determined this value of the supremum limit of s(n) n log 2 φ ; in the same paper, they mention that this problem actually dates back to Berlekamp, Conway, and Guy in 1982 [1]. However, we have no fear that our results are unoriginal because the bounds we derive apply to the more general family of sequences s b (n) and are stronger than those given in [4]. In addition, our methods of proof are quite different from those used in [4]. Coons and Tyler use clever analytic estimates to prove their results from the recursive definition of s(n). By contrast, we will make heavy use of the interpretation of s b (n) as the number of base b over-expansions of n − 1 in order to prove several of our most important results. In particular, we will combine this combinatorial interpretation of s b (n) with the transfer-matrix method in order to prove Theorem 2.1. In turn, Theorem 2.1 will allow us to determine the maximum values of s b (n) when n is restricted to certain intervals.

Determining Maximum Values
Throughout this section, fix an integer b ≥ 2. Our goal is to derive upper bounds for the numbers s b (n), particularly those values of n that are slightly larger than a power of b (we will make this precise soon). To do so, we will make use of the following sequence. Alternatively, we may calculate h m using the recurrence relation along with the initial value h 1 = 1. For example, h 3 = b + 1, h 4 = b 2 + 1, h 5 = b 3 + b + 1, and h 6 = b 4 + b 2 + 1. It is important to note that h m ≡ 1 (mod b) for all m ∈ N. We state the following lemma for easy reference, although we omit the proof because it is fairly straightforward. The following lemma lists three simple but useful observations about the numbers s b (n). We omit the proof because it follows easily from (1). Lemma 2.2. Let n and k be nonnegative integers with b k ≤ n ≤ b k+1 .
ii. If k = 1, then s b (n) ≤ 2, where equality holds if and only if n ≡ 1 (mod b).
iii. If k ≥ 1 and n ≡ 1 (mod b), then s b (n) = s b (n ) for some integer n with b k−1 ≤ n ≤ b k .
Proof. That we may write n uniquely in the form n = jb k + t is trivial. The proof of the rest of the proposition is by induction on k. The case k = 0 is immediate from the first part of Lemma 2.2. The case k = 1 follows from the second part of the same lemma. Now, assume k > 1. We divide the proof into three cases.
Case 1: In this case, suppose t = h k or t = h k+1 . We will assume that t = h k and that k is even; a similar argument holds if k is odd or t = h k+1 . Thus, n = jb k + h k . Because k is even, we may use (2) to write h k = bh k−1 − b + 1 and h k−1 = bh k−2 + 1. Furthermore, h k ≡ 1 (mod b 2 ) because k is even. Since n ≡ h k ≡ 1 (mod b 2 ), we have by Lemma 1.1 that , we may write t = bt + 1 for some integer t < b k−1 .
Using (1), we have If t ≡ 0, 1 (mod b), then we know from Lemma 2.2 and the fact that (3) and induction on k, it follows that if t ≡ 0, 1 (mod b), then This is a contradiction, so t ≡ 0, 1 (mod b). We will assume that t ≡ 0 (mod b); a similar argument may be used to derive a contradiction in the We see by (3) and induction that where the equality s b (jb k−1 + t ) = s b (jb k−2 + t ) is immediate from (1). This last inequality must be an equality since we are assuming s b (n) ≥ F k+2 , so we must have s b (jb k−2 + t ) = F k and s b (jb k−1 + t + 1) = F k+1 . The induction hypothesis states that this is only possible if t ∈ {h k−2 , h k−1 } and t + 1 ∈ {h k−1 , h k }. Suppose first that t = h k−2 and t + 1 = h k−1 . We have h k−1 = bh k−2 + 1, so it follows from (2) that k must be even. Using (2) again, we see that which contradicts our assumption that t = h k . Similarly, if t = h k−1 and t + 1 = h k , then we may derive the contradiction t = h k+1 . It is clearly impossible to have t = h k−1 and t + 1 = h k−1 since t = bt . Therefore, we are left to conclude that t = h k−2 and t + 1 = h k . If k is even, then we may use (2) to write which is impossible. This means that k must be odd, so h k = bh k−1 + 1 by (2). Since h k = t + 1 = bt + 1 = bh k−2 + 1, we conclude that h k−1 = h k−2 .
It is easy to see from Definition 2.1 that this is only possible if k = 3. Hence, t = h 1 = 1, t = h 3 − 1 = b, and t = bt + 1 = b 2 + 1. However, this means that t = h 4 = h k+1 , which is our final contradiction because we assumed t ∈ {h k , h k+1 }.
Now that we know the maximum values of s b (n) for b k ≤ n < b k+1 , we may easily derive the following result.
Proof. We will need Binet's formula for the Fibonacci numbers, which states For each positive integer k, let We now wish to show that lim sup for some positive integer k, then we know from Proposition 2.1 that We saw in the proof of Corollary 2.1 that Hence, we need only find a sufficiently strong upper bound for s b (n) when b k ≤ n ≤ b k + h k for some positive integer k. For this purpose, we make the following definitions.
Our goal is to calculate µ(k, r, y) for any given nonnegative integers k, r, y that satisfy 2y < r < k − 1. This will allow us to to derive tight upper bounds for all integers n that satisfy b k ≤ n ≤ b k + h k for some k by choosing appropriate values of r and y. One might think that a simple inductive argument based on the recurrence relation (1) should be able to derive our upper bounds quite effortlessly. However, the author has found that attempts to prove upper bounds for s b (n) using induction often fail or become incredibly convoluted. Indeed, the reader may wish to look at [4] in order to appreciate the surprising amount of ingenuity that Coons and Tyler need for the derivation of their upper bounds (which are weaker than ours) in the specific case b = 2. Therefore, we shall prove a sequence of lemmas in order to develop more combinatorial means of calculating µ(k, r, y) and ν(k, r, y). Lemma 2.3. Let a t a t−1 · · · a 0 be the ordinary base b expansion of a positive integer n. Let c c −1 · · · c 0 be a base b over-expansion of n. Set c i = 0 for all integers i with < i ≤ t. For any m ∈ {0, 1, . . . , t}, are base b over-expansions of the same number. Therefore, for any j ∈ {0, 1, . . . , t}, . . , t}, then it follows from (4) and the fact that It follows that To complete the proof, we simply need to show that if c m > a m , then either a m = 0 and b m ∈ {b − 1, b} or a m = 1 and c m = b. (4)), so we know from (5) that Lemma 2.4. Let k, r, y be nonnegative integers with 2y < r < k − 1. If a t a t−1 · · · a 0 is the ordinary base b expansion of ν(k, r, y) − 1, then t = k, a k = 1, a j = a 0 = 0 for all j ∈ {r + 1, . . . , k − 1}, and a i ∈ {0, 1} for all i ∈ {0, 1, . . . , k}.
Proof. Let ν = ν(k, r, y), and let a t a t−1 · · · a 0 be the ordinary base b expansion of ν − 1. It follows from the fact that ν ∈ I(k, r, y) that t = k, a k = 1, and a j = 0 for all j ∈ {r + 1, . . . , k − 1}. We still need to show that a 0 = 0 and a i ∈ {0, 1} for all i ∈ {0, 1, . . . , k}. Suppose, for the sake of finding a contradiction, that a m ∈ {2, 3, . . . , b − 1} for some m ∈ {0, 1, . . . , k}. Because a k = 1, we know that m ∈ {0, 1, . . . , k − 1}. Let ν = ν − (a m − 1)b m . The ordinary base b expansion of ν − 1 is simply the word obtained from a k a k−1 · · · a 0 by replacing the m th digit (which is a m ) with 1. Observe that ν < ν and ν ∈ I(k, r, y) since Hence, by the definition of ν in Definition 2.2, s b (ν ) < s b (ν). Choose some base b over-expansion c c −1 · · · c 0 of ν − 1, and let f (c c −1 · · · c 0 ) be the word obtained from c c −1 · · · c 0 by replacing the m th digit (which is c m ) with c m − a m + 1. Lemma 2.3 implies that c m − a m + 1 ∈ {0, 1} because We see that f is an injection from the set of base b over-expansions of ν − 1 to the set of base b over-expansions of ν − 1. This contradicts the fact that s b (ν ) < s b (ν), so we conclude that a i ∈ {0, 1} for all i ∈ {0, 1, . . . , k}.
We are left with the task of showing that a 0 = 0. Suppose a 0 = 0. By the preceding paragraph, we must have a 0 = 1. This means that ν ≡ 2 (mod b), so by (1). Since ν ≡ 2 (mod b) and ν > b k by definition, we know that ν − 1 > b k . Therefore, ν − 1 ∈ I(k, r, y) and s b (ν) < s b (ν − 1), which contradicts the definition of ν. It follows from this contradiction that a 0 = 0.
Lemma 2.4 hints that it is of interest to enumerate the base b overexpansions of positive integers whose ordinary base b expansions use only the digits 0 and 1. Let e 0 , e 1 , . . . , e be nonnegative integers with e 0 < e 1 < · · · < e , and let n = b e 0 + b e 1 + · · · + b e . Let Q i denote the operation that changes one base b over-expansion of n into another by increasing the i th digit of an expansion by b and decreasing the (i + 1) th digit of the expansion by 1. The operation Q i can only be used if the i th digit of the expansion under consideration is a 0. If we use the operation Q i when the (i + 1) th digit of the expansion is a 0, then this digit is immediately converted to a b − 1 and the (i + 2) th digit is reduced by 1. If the (i + 2) th digit is also 0, then it is immediately converted to a b − 1 and the (i + 3) th digit is reduced by 1. This process continues until a nonzero digit is reduced by 1. After using the operation Q i , any leading 0's are erased from the expansion. The transformation of 0's to (b − 1)'s is analogous to the transformation of 0's to 9's that occurs when the number 1 is subtracted from the number 10000, resulting in 9999. As an example, only the operations Q 2 , Q 4 , Q 5 , Q 6 , and Q 8 may be used to transform the expansion 1010001011 into a new expansion. The operation Q 4 changes the expansion 1010001011 into the expansion 100(b − 1)(b − 1)b1011. The operation Q 8 first changes the expansion 1010001011 into 0b10001011; the leading 0 is then erased, yielding b10001011.
We will transform the ordinary base b expansion of n into a base b overexpansion c t c t−1 · · · c 0 of n by repeated use of the operations just described.
At each step, we will choose the value of c e i for some i ∈ {0, 1, . . . , } while simultaneously deciding the values of c j for all j ∈ {e i−1 + 1, e i−1 + 2, . . . , e i − 1} (or all j < e i in the case i = 0). We proceed by permanently deciding the values of c 0 , c 1 , . . . , c e 0 , then permanently deciding the values of c e 0 +1 , c e 0 +2 , . . . , c e 1 , and so on until we decide the values of c e −1 +1 , c e −1 +2 , . . . , c e . We omit c e from the word c t c t−1 · · · c 0 if c e = 0; in this case, t = e − 1. For the sake of providing a concrete example of this process, we will suppose that {e 0 , e 1 , . . . , e } = {2, 4, 5, 9, 11} and b = 7. Here, the ordinary base 7 expansion of n is 101000110100. Since e 0 = 2, we first choose the value of c 2 (while simultaneously deciding the values of c 0 and c 1 ). There is only one way to set c 2 = 1; namely, we keep the same expansion 101000110100. If we want to have c 2 = 0, then we could either perform the operation Q 0 to get the expansion 101000110067 or perform the operation Q 1 to get the expansion 101000110070. Similarly, if we want to have c 2 = 7, then we could either perform the operations Q 0 and then Q 2 to obtain 101000106767 or perform the operations Q 1 and then Q 2 to get 101000106770. That is, there are e 0 = 2 ways to set c 2 = 0 and e 0 = 2 ways to set c 2 = 7. By Lemma 2.3, 0, 1, and 7 are the only possible values of c 2 . For this example, we will assume we chose to use the operations Q 1 and Q 2 to get the expansion 101000106770. Next, we choose the value of c 4 because e 1 = 4. Because we used the operation Q 2 , the 4 th digit of the expansion was temporarily converted into a 0. This means that there is no way to set c 4 = 1 using the operations Q i . There is one way to set c 4 = 0; just keep the expansion 101000106770. Similarly, there is one way to set c 4 = 7; just use the operation Q 4 to obtain 101000076770. We will assume that we make the former choice and keep the expansion 101000106770. Next, we choose the value of c 5 since e 2 = 5. The only way to set c 5 = 1 is to keep the expansion the same. Since we have already determined c 0 , c 1 , c 2 , c 3 , c 4 , we cannot perform any of the operations Q 0 , Q 1 , Q 2 , Q 3 , Q 4 in order to temporarily reduce the 5 th digit of the expansion by 1. In other words, c 5 is stuck with the value 1. We now have the expansion 101000106770, and we wish to choose the value of c 9 (since e 3 = 9) while simultaneously determining the values of c 6 , c 7 , c 8 . Again, the only way to make c 9 = 1 is to keep the expansion 101000106770. To make c 9 = 0, we could use Q 6 to get 100667106770, use Q 7 to get 100670106770, or use Q 8 to get 100700106770. To set c 9 = 7, we could use Q 6 and then Q 9 to obtain 67667106770, use Q 7 and then Q 9 to get 67670106770, or use Q 8 and then Q 9 to get 67700106770. Hence, there are e 3 − e 2 − 1 = 3 ways to set c 9 = 0 and e 3 − e 2 − 1 = 3 ways to set Figure 1: The edge-weighted digraph G for the given example. Note that each of the vertices u 0 , v 0 , w 0 is drawn twice. c 9 = 7. We will assume that we choose to use Q 7 (and not Q 9 ) to obtain the expansion 100670106770. All that is left to do is decide the value of c 11 (while simultaneously determining c 10 ). We cannot set c 11 = 7 because there is no nonzero digit to the left of the 11 th digit from which to "borrow." Alternatively, one could observe that if c 11 = 7, then c 11 c 10 · · · c 0 would be a base 7 over-expansion for a number strictly larger than n. We can, however, keep the expansion 100670106770 if we wish to set c 11 = 1. There is one way (because e 4 − e 3 − 1 = 1) to set c 11 = 0; simply use the operation Q 10 to obtain the expansion 70670106770. Figure 1 depicts an edge-weighted digraph G which encodes all the possible choices that we could have made in this example. The graph has only fifteen vertices, but we have drawn each of the vertices u 0 , v 0 , w 0 twice in order to improve the aesthetics of the image. The vertex u i corresponds to choosing to set c e i = 0. The vertex v i corresponds to setting c e i = 1. The vertex w i corresponds to setting c e i = 7. The weights of the edges correspond to the number of choices possible. For example, if we have chosen to let c 5 = 0 (corresponding to the vertex u 2 ), then there are three ways to set c 9 = 7 (corresponding to the vertex w 3 ). Thus, there is an edge of weight 3 from u 2 to w 3 . After setting c 9 = 7, it is impossible to set c 11 = 1, so there is an edge of weight 0 from w 3 to v 4 . The reader might ask why there are edges from u 4 , v 4 , w 4 to u 0 , v 0 , w 0 . We include these edges because we wish to interpret base 7 over-expansion of n in terms of closed walks in the graph G. There are edges of weight 2 from u 4 , v 4 , w 4 to u 0 because there are two ways to set c 2 = 0, regardless of the value of c 11 (recall that we choose c 2 before choosing c 11 ). Similarly, there are edges of weight 1 from u 4 , v 4 , w 4 to v 0 and edges of weight 2 from u 4 , v 4 , w 4 to w 0 .
Suppose we want to construct a base 7 over-expansion of n in which c 2 = 0, c 4 = 1, c 5 = 1, c 9 = 7, and c 11 = 0. This choice of the values of c e i for i ∈ {0, 1, 2, 3, 4} corresponds to the closed walk (u 0 , v 1 , v 2 , w 3 , u 4 , u 0 ) in G. The weight of this walk (which we calculate as the product of the weights of its edges) is 6, so there are 6 base 7 over-expansions of n with these specific values of c 2 , c 4 , c 5 , c 9 , c 11 . As another example, there are no base 7 over-expansions of n in which c 2 = 7, c 4 = 7, c 5 = 1, c 9 = 0, and c 11 = 1 because the weight of the closed walk (w 0 , We are finally in a position to enumerate the base 7 over-expansions of n. To do so, we will need the following definition. If we put the vertices of G in the order u 0 , v 0 , w 0 , u 1 , v 1 , w 1 , . . . , u 4 , v 4 , w 4 , then the adjacency matrix of G (written as a block matrix) is and O denotes the 3 × 3 zero matrix. The total number of base 7 overexpansions of n is equal to the sum of the weights of the closed walks of length 5 in G that start at u 0 , v 0 , or w 0 . This, in turn, is equal to the sum of the first three diagonal entries of A 5 . Using elementary linear algebra, we see that the first three rows and the first three columns of A 5 intersect in a 3 × 3 block given by M 1 M 2 M 3 BC. Therefore, the sum of the first three diagonal entries of where Tr denotes the trace of a matrix. One easily calculates this value to be 158.
We now state this result in greater generality (and in a slightly different form). Sketching the proof of the following theorem, we trust the reader to see that the method used in the preceding example is representative of the method used in general.
Theorem 2.1. Let e 0 , e 1 , . . . , e be nonnegative integers with e 0 < e 1 < · · · < e (where ≥ 1). Let d i = e i − e i−1 − 1 for all i ∈ {1, 2, . . . , }. The number of base b over-expansions of the number b e 0 + b e 1 + · · · + b e is given by Let G be the edge-weighted digraph with vertex set {u 0 , v 0 , w 0 , u 1 , v 1 , w 1 , . . . , u , v , w } and adjacency matrix A. Suppose we wish to construct a base b over-expansion c t c t−1 · · · c 0 of n. As in the example above, specifying the values of c e 0 , c e 1 , . . . , c e (each such value must be 0, 1, or b by Lemma 2.3) corresponds to choosing a closed walk of length + 1 in G starting at u 0 , v 0 , or w 0 . The weight of this walk is the number of base b over-expansions c e c e −1 · · · c 0 of n that have the specified values of c e 0 , c e 1 , . . . , c e . Therefore, the total number of base b over-expansions of n is equal to the sum of the first three diagonal entries of A +1 . The first three rows and the first three Therefore, using the fact that Tr(XY ) = Tr(Y X) for any square matrices X, Y of the same size, we conclude that We omit the proofs of the following three lemmas because they are fairly straightforward.
Lemma 2.5. The set Ξ is closed under matrix multiplication, and Ξ is a monoid under matrix multiplication. For any nonnegative real number u, M u , N u ∈ Ξ. Lemma 2.6. Let X be a 3 × 3 matrix with nonnegative real entries, and let Y ∈ Ξ . If the second diagonal entry (the entry in the second row and the second column) of X is positive, then Tr(XY ) > 0. Lemma 2.7. For any positive integer t, The following lemma attempts to gain information about the ordinary base b expansion of ν(k, r, y) − 1 when 2y < r < k − 1. By Lemma 2.4, all of the digits in that expansion are 0's and 1's, so we may write ν(k, r, y) − 1 = b e 0 + b e 1 + · · · + b e for some nonnegative integers e 0 , e 1 , . . . , e that satisfy e 0 < e 1 < · · · < e = k. Because ν(k, r, y) ∈ I(k, r, y), we have where equality cannot hold for all j. Hence, we may consider the smallest nonnegative integer λ such that e −1−λ ≤ r − 2λ − 1.
Furthermore, e = k, so we find that where we have used the inequalities e −1−λ ≤ r − 2λ − 1 and λ ≤ y. This shows that ν 1 ∈ I(k, r, y), so s b (ν 1 ) ≤ s b (ν) by the definition of ν. Our goal is to derive a contradiction by showing that We saw that t < − 1 − λ, so t + 1 < . This shows that the matrix product defining B is nonempty. Lemma 2.5 implies that B ∈ Ξ. Now, e 0 = 2(0) + 1 = 1. By Theorem 2.1, We may write by Theorem 2.1. Consequently, We remark that one must take care when considering the case t = 0. In this case, M t 1 is the 3 × 3 identity matrix. A straightforward calculation invoking Lemma 2.7 shows that (7), we see that N d t+1 −2 is a matrix with nonnegative entries whose second diagonal entry is positive. By Lemma 2.6, s b (ν 1 ) − s b (ν) > 0, which is our desired contradiction.
Next, we assume a 1 = 1 and a m = a m+1 = 1. The proof is similar to that given in the preceding paragraph. It follows from the minimality of m that a i = 0 for all even nonnegative integers i < m and a j = 1 for all odd positive integers j < m. Also, m must be odd. Let t = m − 1 2 . We have e j = 2j + 1 for all j ∈ {0, 1, . . . , t} and e t = m < m + 1 = e t+1 < e t+2 < · · · < e = k.
We know from Lemma 2.4 that a j = 0 for all j ∈ {r + 1, . . . , k − 1}, so m < r. This implies that e t+1 = m + 1 ≤ r < k = e . Setting ν 2 = so ν 2 ∈ I(k, r, y) and ν 2 < ν. It follows from the definition of ν that s b (ν 2 ) < s b (ν). As in the preceding case, we let The matrix product defining B is nonempty because e t+1 < e . In addition, B ∈ Ξ, so we may write . As in the previous paragraph, note that M t 1 is the 3 × 3 identity matrix if t = 0. By elementary calculations that make use of Lemma 2.7, we find that Thus, which is a contradiction.
We now assume a 1 = 0, a 2 = 1, and a m = a m+1 = 0. Invoking the minimality of m, we see that a i = 1 for all positive even integers i < m and a j = 1 for all positive odd integers j < m. The index m must be odd. Let . We find that e j = 2j + 2 for all j ∈ {0, 1, . . . , t}, so d j = 1 for all j ∈ {1, 2, . . . , t}. Coupling (6) with the assumption that a m = a m+1 = 0 shows us that We find that Because e = k and e −1−i = r − 2i for all nonnegative integers i < λ, we where we have used the inequalities e −1−λ ≤ r − 2λ − 1 and λ ≤ y. It follows that ν 3 ∈ I(k, r, y), so As in the previous two cases, the matrix product defining B is nonempty (because t + 1 < − λ ≤ ) and B ∈ Ξ. Note that e 0 = 2(0) + 2 = 2. We have and . Using Lemma 2.7, one may easily show that (8), there follows that N d t+1 −2 is a matrix with nonnegative entries whose second diagonal entry is positive. By Lemma 2.6, The fourth case we consider is that in which a 1 = 0, a 2 = 1, and a m = a m+1 = 1. By now the reader is probably familiar with the general pattern of the proof. We use the minimality of m to say that a i = 1 for all positive even integers i < m and a j = 1 for all positive odd integers j < m. The index m must be even. Let t = m − 2 2 , and observe that e j = 2j + 2 for all j ∈ {0, 1, . . . , t} and that e t = m < m + 1 = e t+1 < e t+2 < · · · < e = k.
Finally, we consider the case in which a 1 = a 2 = 0. In this case, ν ≡ 1 . This means that ν + b ∈ I(k, r, y), so s b (ν + b) ≤ s b (ν) by the definition of ν. As ν + b ≡ b + 1 (mod b 3 ), we find by (1) and Lemma 1.1 that Therefore, With this contradiction, the proof is complete.
Proof. The proof is very similar to those of the first and third cases considered in the proof of Lemma 2.8. Suppose, by way of contradiction, that e −1−λ ≤ r − 2λ − 2, and let ν = 1 + where we convene to let λ−1 i=0 b r−2i = 0 if λ = 0. Therefore, ν , ν ∈ I(k, r, y).
This means that s b (ν ), s b (ν ) ≤ s b (ν), so we will derive a contradiction by showing that where we define B to be the 3 × 3 identity matrix if λ = 0. By Lemma 2.5, B ∈ Ξ . To ease our notation, let t = − 1 − λ and q = d −λ . We have If λ > 0, then In either case, q ≥ 3, so both F 2t+2 N q−2 and F 2t+3 N q−2 are 3 × 3 matrices with nonnegative real entries whose second diagonal entries are positive. It follows from Lemma 2.6 that if e 0 = 1, then Similarly, if e 0 = 2, then This is a contradiction, so the proof is complete.
This leads us to the following.
Definition 2.6. For any integers k, r, y, define Lemma 2.10. Let k, r, x, y be nonnegative integers such that 2x ≤ 2y < r < k − 1. We have γ(k, r, x) + 1 ∈ I(k, r, y) and s b (γ(k, r, x) + 1) = V (k, r, x). where t = r/2 − x − 1. Observe that the letter (digit) 1 appears exactly r/2 + 1 times in the word w(k, r, x), so it follows from (6) that = r/2 (implying that t + 1 = − x). Let us first assume x = 0. Setting d j = e j − e j−1 − 1 for all j ∈ {1, 2, . . . , }, we have We may invoke Theorem 2.1 to see that Let If 2|r, we may use Lemma 2.7 to find that Similarly, if 2 r, then Therefore, regardless of the parity of r, we have s b (γ(k, r, 0)+1) = Tr(T M k−r ) by (10). Thus, where the last equality is obtained by simply calculating the matrix T M k−r by hand. One may easily show that F r+1 = 1 5 (2L r+2 − L r+1 ) and F r+2 = 1 5 (2L r+1 + L r+2 ), so Let us now assume x > 0. Again, we set d j = e j − e j−1 − 1 for all j ∈ {1, 2, . . . , }, and we see that By Theorem 2.1, If 2|r, then Lemma 2.7 allows us to find that Similarly, if 2 r, then Therefore, no matter the parity of r, we have Using Lemma 2.7 again, we find that Therefore, We now make use of the well-known identity Consequently, Before proceeding to our main result, we need one final easy lemma.
Lemma 2.11. For any integers k, r, x, Proof. Referring to Definition 2.6, we have We are finally in a position to prove our main result.
That is, λ must be the element of the set {0, 1, . . . , y} that maximizes V (k, r, λ) (if there are multiple such elements, we choose the smallest in accordance with the definition of ν(k, r, y) in Definition 2.2). We first assume r is even. We wish to show that λ = y. This is immediate if y = 0, so we will assume y > 0. Choose some x ∈ {0, 1, . . . , y − 1}. We make use of an easily-proven fact about Lucas numbers that states that if m, n are odd integers (not necessarily positive) with m < n, then L m < L n . In this case, we use the assumption that r is even to see that r − 4x − 3 and r − 4x + 1 are odd integers with r − 4x − 3 < r − 4x + 1. Therefore, L r−4x+1 − L r−4x−3 > 0. Because k − r ≥ 2 by hypothesis, we may use Lemma 2.11 to find that As r − 4x − 5 and r − 4x − 1 are odd integers with r − 4x − 5 < r − 4x − 1, we see that V (k, r, x + 1) − V (k, r, x) > 0.
We now assume r is odd. Let x 1 , x 2 be integers such that We will make use of the fact that L m = L −m for any even integer m. Because x 1 ≤ r − 5 4 , we obtain the inequalities r − 4x 1 + 1 > If y < r−1

4
, then which agrees with the statement of the theorem. Therefore, we will henceforth assume that y ≥ r−1 4 so that δ(r, y) = r−1
We end this section with a definition and a theorem that will prove useful in the next section.
Although it is possible to give an easy inductive proof of the following theorem using the simple Fibonacci-like recurrence we prefer a proof based on Theorem 2.1.

Theorem 2.3.
For any integers k and m with 2 ≤ m ≤ k, we have Proof. Referring to Definition 2.1, we see that we may write , e = k, and e j = e 0 + 2j for all j ∈ {0, 1, . . . , − 1}. For example, Defining d i as in Theorem 2.1, we have d j = 1 for all j ∈ {1, 2, . . . , − 1} and By Theorem 2.1, Using Lemma 2.7, one may show that Therefore, If m is even, then e 0 = 2 and = m − 2 2 , so If m is odd, then e 0 = 1 and = m − 1 2 , so

More Manageable Bounds
In the previous section, we derived fairly strong upper bounds (relative to those previously known) for the values of s b (n) for those integers n satisfying b k ≤ n ≤ b k + h k for some integer k ≥ 3. Unfortunately, these bounds are somewhat cumbersome. In this section, we will weaken them in order to make them cleaner and more easily applicable.
Suppose k, m, and n are integers such that 2 ≤ m < k and G k (m) < n < G k (m + 1). We wish to use Theorem 2.2 to show that the point (n, s b (n)) lies below the line segment connecting the points (G k (m), H k (m)) and (G k (m + 1), H k (m + 1)). This leads us to the following definition.
Next, assume m is even. By Theorem 2.
In either case, we may use the identity F u = 1 5 (L u+1 + L u−1 ) to see that This proves (14) in the case when m is even, so the proof is complete.
Throughout the proofs of the following three lemmas, we assume b = 2. For example, since G k (4) = b k + h 4 = b k + b 2 + 1, it will be understood that G k (4) = 2 k + 5.
Next, suppose m is odd. We use the fact that L −u = L u < L v = L −v for any nonnegative even integers u, v with u < v to find that the bilateral sequence . . . , L −4 , L −2 , L 0 , L 2 , L 4 , . . . is strictly convex. Therefore, the maxi- Furthermore, if m ≥ 4 and m ∈ {5, 7}, then Proof. We will use the closed-form expressions F n = φ n − φ n √ 5 and L n = φ n + φ n for the Fibonacci and Lucas numbers. We also make use of the fact that L u ≥ 2 for any even integer u. For any integer j, we have where the last equality follows from the identity φ = −1 φ . Therefore, If m is even, then we may set j = 2 in (15) and invoke the inequality L m−4y ≥ 2 (since m − 4y is even) to find that Let us now suppose m is odd. By Lemma 3.5, Using (15), once with j = 3 and once with j = 5, yields are positive. This completes the proof of the first inequality in the statement of the lemma.
Assume, now, that m ≥ 4 and m ∈ {5, 7}. We may use (15), once with j = 2 and again with j = 4, to see that For m ≥ 4 and m ∈ {5, 7}, it is easy to see that attains its minimum when m = 9. Thus, where this last equality is easily verified. Alternatively, we could have proven the second inequality stated in the lemma using the fact that Lemma 3.7. Let k and m be integers such that k ≥ 5 and 2 ≤ m ≤ k − 1.
Define a function Θ k,m : R → R by For any Proof. We begin with the easily-proven fact that One may easily show that for any choice of an integer b ≥ 2 (if b ≥ 3, this follows from the observation that b 2 > 6 log b φ). In addition, using Definition 2.1 and Lemma 2.1, we have Choose some x ≥ 0. We have Adding xT k (m) log b φ + b k T k (m) to each side of this last inequality yields which we may rewrite as Now, referring to the paragraph immediately following Definition 3.1, we see that J k,m (b k + x) = T k (m)(x − h m ) + H k (m). Therefore, (16) becomes We are finally ready to prove the main results of this section.
Theorem 3.1. If k, m, and n are integers such that 2 ≤ m < k and G k (m) < n < G k (m + 1), then s b (n) < J k,m (n).
It follows from Theorem 2.2, Definition 2.6, Definition 2.7, and the identity This shows that if y = 0, then where we have used the trivial fact that J k,m is an increasing function. Therefore, we may assume y > 0. Because of the way we chose y, this means that Note that this also forces m ≥ 4 because y ≤ m−2

2
. By a similar token, it follows from Lemma 3.3 that , then the desired result is simply Lemma 3.4. This means that if b = 2 and m ∈ {5, 7}, then we may assume n ≥ 2 k + G m−1 (m − 3) + 1. We have two cases to consider.
Case 1: In this case, assume that µ(k, m − 1, y) = V (k, m − 1, y). Recall Definition 2.6 to see that We now use the fact that L m−4y−1 < L m−1 (which follows immediately from Lemma 3.5) as well as the identity we simply need to show that in order to obtain (17). After dividing each side by k − m and using the identity we find that this last inequality becomes which we may rewrite as after subtracting F m+1 from each side and then rearranging terms. We will prove (18) in each of the following two subcases.
No matter the value of b, we find from Lemma 3.6 that which is (18).
which proves (18) with the help of Lemma 3.6. If b ≥ 4, then which proves (18) once again.
Using the fact that γ(k, m−1, This proves (17) and completes the proof of the theorem.
Proof. Corollary 2.1 states that so we will now prove the reverse inequality. For each integer k ≥ 3, let Recall that we showed in the proof of Corollary 2.1 that We will show that It will then follow from (20) and (21) that which will complete the proof. In order to derive (21), let us choose some integer n > b 5 . Let θ = θ(n), and note that b θ < n ≤ b θ+1 . It follows from Proposition 2.1 that We will show that f k is increasing and concave down on the open interval (1, α). The desired inequality will then follow quite easily. Observe that we may write f k (x) = g k (β(x)), where where we have used the inequality log that holds for all u > −1 (as well as the inequalities k ≥ 3 and b ≥ 2). Therefore, where C 1 = φ 2 log φ − log φ 4 log 2 − 1 ≈ 0.086 . . . and C 2 = −φ −2 log φ + log φ 4 log 2 − 1 ≈ −1.010 . . . .
Therefore, to show that f k is concave down on the interval (1, α), we just need to show that g k (β(x)) log b > g k (β(x)) for all x ∈ (1, α). To do so, it suffices to show that for all x ∈ (2, log b (b k + b 2 − b)).
We have shown that f k is increasing and concave down on the interval (1, α). Now, suppose m is odd and 3 ≤ m ≤ k. Because m is odd, one may easily show that h m = 1 + we may use the fact that f k is increasing on (1, α) to see that Similarly, if m is even and 2 ≤ m ≤ k, then Hence, f k (G k (m)−b k ) > H k (m) for all m ∈ {2, 3, . . . , k}. We may now prove that s b (n) < f k (n − b k ) for all n ∈ {b k + 1, b k + 2, . . . , b k + h k }. Choose such an integer n. If n = G k (m) for some m ∈ {2, 3, . . . , k}, then it follows from Theorem 2.3 and the preceding discussion that s b (n) = H k (m) < f k (n − b k ).

Concluding Remarks
We wish to acknowledge some of the potential uses and extensions of results derived in this paper. First, we note that Theorem 2.1 allows us to derive explicit formulas for the values of s b (n) for integers n whose ordinary base b expansions have certain forms. For example, we were able to invoke Theorem 2.1 in the proof of Theorem 2.3 in order to show that s b (G k (m)) = H k (m). As another example, it is possible to use Theorem 2.1 to show that for any positive integers x 1 , x 2 , x 3 . The equation (29) appears with several similar identities (many of which can be deduced from Theorem 2.1) in [3].
Second, arguments based on symmetry and periodicity may be used to extend the upper bounds given by Theorems 2.2, 3.1, and 3.2. For example, referring to the top image in Figure 2, one will see that the plot of s 2 (n) forms several "mound" shapes. However, only the left sides of the mounds are bounded above by the green curves. It is known [5, page 2] that if k ∈ N, then s 2 (2 k + x) = s 2 (2 k+1 − x) for all x ∈ {1, 2, . . . , 2 k }.