The terms of the Virahanka–Fibonacci sequence (V(n))n≥0 (OEIS A000045, shifted to start with V(0)=1 instead of 0) count the number of ways each natural number n can be expressed as a sum of 1s and 2s, in which the order in the sum matters. For example, V(5)=8 because 5=1+1+1+1+1=1+1+1+2=1+1+2+1=1+2+1+1=2+1+1+1=1+2+2=2+1+2=2+2+1
Here is one way to find an exact expression for V(n). The coefficient of xn in the polynomial (x+x2)k expresses the number of ways to write n as a sum of exactly k 1s and 2s. (Try it!) We can add these polynomials together as a geometric series to obtain the generating function f(x)=∞∑n=0V(n)xn=∞∑k=0(x+x2)k=11−x−x2.
Now, what if we want to know not only how many ways n can be expressed as a sum of 1s and 2s, but how many 1s and 2s are needed, on average, to create a sum that equals n? For example, among the eight ways to write 5 as a sum of 1s and 2s, there are a total of twenty 1s and ten 2s, with thirty terms in all. So, on average, a sum that equals 5 has 2.5 1s and 1.25 2s, for an average of 3.75 terms.
We can adapt the method of generating functions by introducing new variables that allow us to keep track of how many times 1 and 2 appear in a sum. We’ll use t to represent a 1 in a sum and u to represent a 2. Then the coefficient of xn in (tx+ux2)k will be a polynomial in t and u such that the coefficient of tpuq counts the number of ways to express n as a sum of p 1s and q 2s, with p+q=k. As before, we can add these polynomials together in a series to get the multivariate generating function F(x,t,u)=∞∑k=0(tx+ux2)k=11−tx−ux2.
We can determine the coefficients of Pn(t,u) explicitly using binomial coefficients. If a sum has p+q terms of which p are 1s and q are 2s, then there are (p+qp)=(p+qq) ways to arrange the terms (among the p+q terms, select the positions for the 1s or for the 2s, respectively). If the sum is equal to n, then p+2q=n, and so Pn(t,u)=∑p+2q=n(p+qp)tpuq=∑p+2q=n(p+qq)tpuq=⌊n/2⌋∑q=0(n−qq)tn−2quq.
in a sum of 1s and 2s equal to | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
the average number of 2s is | 0 | 1/2 | 2/3 | 1 | 5/4 | 20/13 | 38/21 | 71/34 |
But how can we study how this average behaves asymptotically?
Let’s write T1(n) for the total number of 1s in all sums of 1s and 2s equal to n, T2(n) for the total number of 2s, and T(n)=T1(n)+T2(n) for the total number of all terms. We already have an expression for T2(n) above; let’s consider its structure. It takes each coefficient of tpuq in Pn(t,u) and multiplies that coefficient by q, then adds together the results. The same quantity can be obtained by differentiating Pn(t,u) with respect to u and evaluating the result at (t,u)=(1,1). That is, T2(n)=⌊n/2⌋∑q=0q(n−qq)=∂∂uPn(t,u)|(t,u)=(1,1).
P.S. The polynomials Pn(t)=Pn(t,1) that appear as coefficients of xn in the expansion of 1/(1−tx−x2) are sometimes called Fibonacci polynomials. They satisfy a recurrence relation similar to that of the Fibonacci numbers themselves: P0(t)=1,P1(t)=t,Pn(t)=tPn−1(t)+Pn−2(t).
P.P.S. In the book Analytic Combinatorics by P. Flajolet and R. Sedgewick, an example in chapter 3 (Proposition III.4) shows that, if one allows compositions with terms of any size, not just 1s and 2s, then for any n≥1 the average number of terms in a composition of n is always (n+1)/2, and as n→∞, the number of times an integer m≥1 appears in a composition of n tends to n/2m+1. That is, for large n, about half of the terms are 1s, about a quarter of the terms are 2s, and so on. My guess is that for compositions with terms no larger than N, the appearances of 1, 2, …, N will distribute according to powers of the positive solution to xN+xN−1+⋯+x=1. When N=2, this solution is 1/φ, and as N→∞ it approaches 1/2.
No comments:
Post a Comment