Skip to main content
PLOS One logoLink to PLOS One
. 2022 Nov 17;17(11):e0274448. doi: 10.1371/journal.pone.0274448

Explicit solution of divide-and-conquer dividing by a half recurrences with polynomial independent term

Tomás M Coronado 1,2,#, Arnau Mir 1,2,#, Francesc Rosselló 1,2,*,#
Editor: Ashwani Kumar3
PMCID: PMC9671444  PMID: 36395273

Abstract

Divide-and-conquer dividing by a half recurrences, of the form

xn=a·xn/2+a·xn/2+p(n),n2,

appear in many areas of applied mathematics, from the analysis of algorithms to the optimization of phylogenetic balance indices. These equations are usually “solved” by means of a Master Theorem that provides a bound for the growing order of xn, but not the solution’s explicit expression. In this paper we give a finite explicit expression for this solution, in terms of the binary decomposition of n, when the independent term p(n) is a polynomial in ⌈n/2⌉ and ⌊n/2⌋. As an application, we obtain explicit formulas for several sequences of interest in phylogenetics, combinatorics, and computer science, for which no such formulas were known so far: for instance, for the Total Cophenetic index and the rooted Quartet index of the maximally balanced bifurcating phylogenetic trees with n leaves, and the sum of the bitwise AND operator applied to pairs of complementary numbers up to n.

Introduction

Divide-and-conquer dividing by a half recurrences, of the form

xn=a·xn/2+a·xn/2+p(n),n2, (1)

appear in many areas of applied mathematics. As evidence, for instance, the On-line Encyclopedia of Integer Sequences (OEIS, https://oeis.org) contains more than 200 integer sequences with the keyword “divide and conquer’, many of which satisfy a recurrence like (1) [1].

The most popular and best studied setting where such recurrences arise is in Computer Science, and more specifically in the analysis of balanced divide and conquer algorithms. This type of algorithms solve a problem by splitting its input into two or more parts of the same size, solving (recursively) the problem on these parts, and finally combining these solutions into a solution for the global instance [2, §2.6–7]. Typical examples of this strategy are the heapsort and mergesort algorithms and several fast integer and matrix multiplication methods. When the input is split into two parts of the same size (up to a unit of difference, when the size of the original input is odd) and both parts contribute equally to the final solution, the algorithm’s running time tn on an instance of size n satisfies a recurrence of the form

tn=a·tn/2+a·tn/2+p(n)

where the independent term p(n), called in this context the toll function, represents the cost of combining the solutions of the subproblems into a solution for the original problem.

Our interest in this type of recurrences stems from the study of phylogenetic balance indices. A phylogenetic tree, the standard representation of the joint evolutionary history of a group of extant species (or other Operational Phylogenetic Units, OPU, like genes, languages, or myths), is, from the formal point of view, a leaf-labeled rooted tree. In a phylogenetic tree, its leaves represent the species under study, its internal nodes represent their common ancestors, the root represents the most recent common ancestor of all of them, and the arcs represent direct descendance through mutations [3, 4]. A phylogenetic tree is bifurcating, or fully resolved, when every internal node has two direct descendants, or children.

Biologists use the shape of phylogenetic trees, that is, their raw branching structure, to deduce information on the forces beneath the speciation and extinction processes that have taken place [5]. A popular set of tools used in the analysis of phylogenetic tree shapes are the shape indices [6], and among them the balance indices, which measure the propensity of the direct descendants of any given node in a tree to have the same number of descendant leaves. Many balance indices have been proposed in the literature: see, for instance, [3, 715] and the recent survey [16] and the references therein. Let us recall here the four indices that appear below in the Examples section:

  • The Sackin index S(T) of a tree T [14, 15] is the sum of its leaves’ depths (that is, of the lengths of the paths from the root to the leaves).

  • The Colless index C(T) of a bifurcating tree T [7] is the sum, over all its internal nodes v, of the absolute value of the difference between the numbers of descendant leaves of the pair of children of v.

  • The Total Cophenetic index Φ(T) of a tree T [12] is the sum, over all its pairs of internal nodes, of the depth of their lowest common ancestor.

  • The rooted Quartet index rQI(T) of a bifurcating tree T [17] is the number of its subtrees of 4 leaves that are fully symmetric.

Any sensible balance index should classify, for each number of leaves n, as most unbalanced trees the rooted caterpillars with n leaves Kn —the bifurcating trees such that all their internal nodes have a leaf child— and as most balanced bifurcating trees the maximally balanced trees with n leaves Bn —where, for each internal node, the numbers of descendant leaves of its pair of children differ at most in 1— (cf. Fig 1). The four indices described above satisfy this condition [16].

Fig 1. A rooted caterpillar with 7 leaves (left) and a maximally balanced with 7 leaves (right).

Fig 1

Now, given a balance index I, it is unreasonable to expect it to allow for the direct comparison of the balance of trees with different numbers of leaves. A possible way to circumvent this difficulty is to normalize it to [0, 1] for every number of leaves n by subtracting its minimum value for this number of leaves and dividing by its range of values on the space of trees with n leaves [15, 18]. To perform this normalization for bifurcating trees, it is necessary to know the value of I on the rooted caterpillars Kn and the maximally balanced trees Bn. It turns out that, while computing I(Kn) is usually easy, to compute I(Bn) one is led in most cases to solve a recurrence of the form

I(Bn)=I(Bn/2)+I(Bn/2)+pI(n)

with pI(n) a function that, in some sense, measures the contribution of the root to the value of I. For the four aforementioned indices, this independent term is a polynomial in ⌈n/2⌉ and ⌊n/2⌋: for the Sackin index, pS(n) = n = ⌈n/2⌉ + ⌊n/2⌋; for the Colless index, pC(n) = ⌈n/2⌉ − ⌊n/2⌋; for the Total Cophenetic index, pΦ(n)=(n2)=(n/2+n/22); and for the rooted Quartet index, prQI(n)=(n/22)(n/22) [16]. At the moment of writing this paper, the values of S(Bn) and C(Bn) were known (see Examples 2 and 3), but not those of Φ(Bn) or rQI(Bn).

In the context of the analysis of algorithms, divide-and-conquer recurrences like (1) and more general ones are “solved” by bounding the growing order of xn using some Master Theorem. The original Master Theorem was obtained by Bentley, Haken, and Saxe [19] and extended in [20, §4.5–6], and since then it has been extended to more general divide-and-conquer recurrences: see, for instance [2128]. Tipically, a Master Theorem deduces information on the asymptotic behaviour of the solution xn of a divide-and-conquer recurrence from the growing order of the independent term of the recurrence, the number of parts into which the input is divided, which we fix here to 2, and the contribution of each subproblem to the general problem, which we assume here to be equal and constant and represented by the coefficient a. More specifically, for the sequences satisfying the Eq (1) considered in this paper, if d is the degree of the bivariate polinomial p, the Master Theorems says that (cf. [20, Thm. 4.1])

xn={Θ(nlog2(a))ifa>2dΘ(nlog2(a)log(n))ifa=2dΘ(nd)ifa<2d

Thus, although “it is easy and fast to use” [25, p. 171], the Master Theorem does not provide an explicit solution of the recurrence, only its order of growth.

Now, in the analysis of algorithms, knowing the growing order of the computational cost of an algorithm on an instance of size n is usually enough. But in other applications, like for instance in order to normalize balance indices as we explained above, an explicit expression for the solution is needed. Many specific divide-and-conquer recurrences are explicitly solved when needed, like for instance the cost of the mergesort algorithm in the worst case, solved as Ex. 34 in [29, Ch. 3], or the homogeneous divide-and-conquer dividing by a half equation (Eq (1) with p = 0), solved in [30, Lem. 21]. But no finite expression for the general solution was known so far. To our knowledge, the only attempt to find an explicit solution of Eq (1) is made by Hwang, Janson and Tsai [31] by proving that, when a = 1 and under very general conditions on the independent term p(n), the solution xn has the form

xn=nP(log2(n))+F(n)-Q(n)

with P continuous and 1-periodic and F, Q of precise growing orders. The authors also give explicit expressions for P, F, and Q in terms of infinite series expansions, but they are only able to give them in a finite form in a few examples, even for polynomial independent terms.

In this paper we consider the case when a is an arbitrary real number but p(n) is a polynomial in ⌈n/2⌉ and ⌊n/2⌋. In this case, we are able to give a finitary explicit formula for xn in terms of the binary decomposition of n. Our formula avoids the use of infinite series: actually, the indices involved in all sums in our expression for xn have a range bounded from above by ⌊log2(n)⌋ and the degree of the independent term p(n).

The rest of this paper is organized as follows. In the Results section we state our main result and we use it to solve several examples. As a proof of concept, in some of them we obtain formulas that were already known, but we also include several interesting examples for which no explicit formula was known so far. Then we devote a section to outline the proof of our main result; the proofs of the intermediate results are provided in the S1 File. We close the paper with a Conclusions section. We have implemented the formula provided by our main theorem in Python using SymPy, a Python library for symbolic mathematics. This implementation is available at https://github.com/biocom-uib/divide_and_conquer.

Results

Main result

For every nN1, let its binary decomposition be n=j=1sn2qj(n), with 0q1(n)<<qsn(n), and then, for every i ⩾ 1, let Mi(n)=j=isn2qj(n). Notice that M1(n) = n and Msn=2qsn(n). In order to simplify the notations, we set q0(n) = 0 and M0(n)=M1(n)+2q0(n)=n+1.

Additionally, for every d,nN and xR0 let

T(d,n,x)=k=0n-1kdxk

(with the convention, which we use throughout this paper, that 00 = 1). In particular,

T(0,n,x)={nifx=1xn-1x-1ifx1T(1,n,x)={(n2)ifx=1nxn(x-1)-x(xn-1)(x-1)2ifx1

For every mN, let Bm denote the m-th Bernoulli number of the first kind [32]. In particular, B0 = 1, B1 = −1/2, and B2k + 1 = 0 for every k ⩾ 1.

For d = 0, 1, for every aR, for every mN, and for every nN1, let

αn(d,m)(a)=12(m+1)i=1snj=0m(m+1j)Bj2jMi(n)m+1-j(T(d,qi(n),a2j-m)-T(d,qi-1(n),a2j-m))+i=1sn-1qi(n)d(a2-m)qi(n)(n-Mi(n))Mi+1(n)m-T(d,qsn(n),2a)·δm=0

with δm = 0 = 1 if m = 0 and δm = 0 = 0 if m > 0.

For every aR>0 and for every r,tN, let a,t = log2(a) − t and

δ(a,r,t)={1ifr>0,anda,t{0,,r-1}0otherwise

If a ⩽ 0, then a,t is undefined and δ(a, r, t) = 0.

The main result in this paper is the following:

Theorem 1. Let aR0 and let P(x,y)=r,t0br,txrytR[x,y] be a bivariate polynomial. Then, the solution of the recurrence equation

xn=a·xn/2+a·xn/2+P(n/2,n/2),n2,

with initial condition x1 is

xn=r,tbr,txn(r,t)(a)+((2a)qsn(n)+(2a-1)(naqsn(n)-(2a)qsn(n)))x1

with, for every n ⩾ 2,

xn(r,t)(a)=k=1r+t(i=kit+a,t+1r+t(ri-t-1)(ik)Bi-ki(2i-1-a))nk+1a-1·δr>0,t=0,a1+(1-l=0la,tr-1(rl)2t+l-a)(T(0,qsn(n),2a)+naqsn(n)-(2a)qsn(n))+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1la,tr-1(rl)(t+li)2t+l-a)αn(0,i)(a)+δ(a,r,t)a(ra,t)(T(1,qsn(n),2a)+(naqsn(n)-(2a)qsn(n))qsn(n)+i=0t+a,t-1(t+a,ti)αn(1,i)(a))

where δr > 0, t = 0, a ≠ 1 = 1 if r > 0, t = 0, and a ≠ 1, and δr > 0, t = 0, a ≠ 1 = 0 otherwise.

In particular:

  • (a) If r = 0,
    xn(0,t)(a)=i=0t-12-i(ti)αn(0,i)(a)+T(0,qsn(n),2a)+naqsn(n)-(2a)qsn(n)={i=0t-12-i(ti)αn(0,i)(1/2)+qsn(n)+n·2-qsn(n)-1ifa=12i=0t-12-i(ti)αn(0,i)(a)+(2a)qsn(n)-12a-1+n·aqsn(n)-(2a)qsn(n)ifa12
  • (b) If r ⩾ 1 and t = 0:
    • (b.1) If a = 1/2,
      xn(r,0)(1/2)=2k=1r(j=kr(rj-1)(jk)Bj-kj(2j-1))nk-2+(1-2l=0r-1(rl)2l+1-1)(qsn(n)+n·2-qsn(n)-1)-i=0r-1(2-i(ri)+2l=i+1r-1(rl)(li)2l+1-1)αn(0,i)(1/2)
    • (b.2) If a = 1,
      xn(r,0)(1)=k=2r(j=kr(rj-1)(jk)Bj-kj(2j-1-1))nk+(qsn(n)+1+j=1r-1(rj)(Bj-1)2j-1)n+1+j=1r-1(rj)2j-1-2qsn(n)+1-i=0r-1(2-i(ri)+l=i+1r-1(rl)(li)2l-1)αn(0,i)(1)
    • (b.3) If a ∉ {1/2, 1, …, 2r−1}
      xn(r,0)(a)=k=1r(j=kr(rj-1)(jk)Bj-kj(2j-1-a))nk+1a-1+(1-l=0r-1(rl)2l-a)((2a)qsn(n)-12a-1+naqsn(n)-(2a)qsn(n))-i=0r-1(2-i(ri)+l=i+1r-1(rl)(li)2l-a)αn(0,i)(a)
    • (b.4) If a = 2 with ∈ {1, …, r − 1},
      xn(r,0)(a)=k=1r(i=ki+1r(ri-1)(ik)Bi-ki(2i-1-a))nk+1a-1+(1-l=0lr-1(rl)2l-a)((2a)qsn(n)-12a-1+naqsn(n)-(2a)qsn(n))-i=0r-1(2-i(ri)+l=i+1lr-1(rl)(li)2l-a)αn(0,i)(a)+1a(r)(((2a-1)qsn(n)-2a)(2a)qsn(n)+2a(2a-1)2+qsn(n)aqsn(n)(n-2qsn(n)))+1a(r)i=0-1(i)αn(1,i)(a)
  • (c) If r ⩾ 1 and t ⩾ 1:
    • (c.1) If a = 1/2,
      xn(r,t)(1/2)=2k=1r+t(j=kr+t(rj-t-1)(jk)Bj-kj(2j-1))nk+(1-2l=0r-1(rl)2t+l+1-1)(qsn(n)+n·2-qsn(n)-1)+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-2l=i-t+1r-1(rl)(t+li)2t+l+1-1)αn(0,i)(1/2)
    • (c.2) If a = 1,
      xn(r,t)(1)=k=2r+t(j=kr+t(rj-t-1)(jk)Bj-kj(2j-1-1))nk+(1+j=1r+t-1(rj-t)(Bj-1)2j-1)n+l=0r-1(rl)2t+l-1-1+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1r-1(rl)(t+li)2t+l-1)αn(0,i)(1)
    • (c.3) If a ∉ {1/2, 1, 2t, …, 2r + t−1},
      xn(r,t)(a)=k=1r+t(j=kr+t(rj-t-1)(jk)Bj-kj(2j-1-a))nk+(1-l=0r-1(rl)2t+l-a)((2a)qsn(n)-12a-1+naqsn(n)-(2a)qsn(n))+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1r-1(rl)(t+li)2t+l-a)αn(0,i)(a)
    • (c.4) If a = 2t + , for some ∈ {0, …, r − 1},
      xn(r,t)(a)=k=1r+t(j=kjt++1r+t(rj-t-1)(jk)Bj-kj(2j-1-a))nk+1a(r)(qsn(n)(2a)qsn(n)-(2a)qsn(n)+1+2a(2a-1)2+qsn(n)aqsn(n)(n-2qsn(n)))+(1-l=0lr-1(rl)2t+l-a)((2a)qsn(n)-12a-1+naqsn(n)-(2a)qsn(n))+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1lr-1(rl)(t+li)2t+l-a)αn(0,i)(a)+1a(r)i=0t+-1(t+i)αn(1,i)(a)

Examples

In this section we gather several applications of our main theorem. The sequences’ identifiers, when available, refer to the OEIS.

Example 1. When the independent term in the divide-and-conquer recurrence is constant,

xn=a·xn/2+a·xn/2+c

with cR, the solution with initial condition x1 is

xn=c·xn(0,0)(a)+((2a)qsn(n)+(2a-1)(naqsn(n)-(2a)qsn(n)))x1={c(qsn(n)+n·2-qsn(n)-1)+x1ifa=12((2a-1)x1+c)(naqsn(n)-2a-22a-1(2a)qsn(n))-c2a-1ifa12

In particular, if a = 1,

xn=(x1+c)n-c.

Example 2. The minimum total Sackin index Sn of a rooted bifurcating tree with n leaves (the binary entropy function: sequence A003314) satisfies the recurrence

Sn=Sn/2+Sn/2+n=Sn/2+Sn/2+n/2+n/2

with S1 = 0. Then, according to our main theorem,

Sn=xn(1,0)(1)+xn(0,1)(1)

where

xn(1,0)(1)=(qsn(n)+1)n+1-2qsn(n)+1-αn(0,0)(1)xn(0,1)(1)=αn(0,0)(1)+n-1

and therefore

Sn=(qsn(n)+1)n+1-2qsn(n)+1-αn(0,0)(1)+αn(0,0)(1)+n-1=(qsn(n)+2)n-2qsn(n)+1

in agreement with previously published formulas: cf. [31, 33].

Example 3. The minimum Colless index cn of a rooted bifurcating tree with n leaves (sequence A296062) satisfies the recurrence

cn=cn/2+cn/2+n2-n2

with c1 = 0. Therefore, according to our main theorem

cn=xn(1,0)(1)-xn(0,1)(1)=(qsn(n)+1)n+1-2qsn(n)+1-αn(0,0)(1)-(αn(0,0)(1)+n-1)=qsn(n)n-2qsn(n)+1+2-2αn(0,0)(1)

Now,

αn(0,0)(1)=12i=1snMi(n)(qi(n)-qi-1(n))+i=1sn-1(n-Mi(n))-2qsn(n)+1=i=1sn2qi(n)-1qi(n)+(sn-1)n-j=1sni=jsn2qi(n)+1=i=1sn2qi(n)-1qi(n)+(sn-1)n-i=1sni2qi(n)+1 (2)
=(sn-1)n+i=1sn2qi(n)-1(qi(n)-2i)+1 (3)

and hence, finally,

cn=qsn(n)n-2qsn(n)+1+2-2((sn-1)n+i=1sn2qi(n)-1(qi(n)-2i)+1)=i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i-1))

as it was proved in [34] by showing by induction that this sequence satisfies the recurrence above.

Example 4. Consider the equation

xn=xn/2+xn/2+(-1)n

This recurrence is related to the Takagi curve [35], which plays an important role in different fields such as analysis, combinatorics, and number theory [36]. Since (−1)n = 1 − 2(⌈n/2⌉ − ⌊n/2⌋), its solution with initial condition x1 is

xn=xn(0,0)(1)-2xn(1,0)(1)+2xn(0,1)(1)+(2qsn(n)+(2-1)(n·1qsn(n)-2qsn(n)))x1=n-1-2i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i-1))+nx1(byExamples1and3)=n-1-2i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i))-4i=1sn-12qi(n)+nx1=n-1-2i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i))-4(n-2qsn(n))+nx1=2qsn(n)+2+(x1-3)n-1-2i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i))

In particular, when x1 = 1,

xn=2qsn(n)+2-2n-1-2i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i))

Consider now the sequence A268289, which we denote by an. Monroe and Job proved in [37] that

an-1=j=0qsn(n)[((n/2j+1)mod2)2j+(-1)(n/2j+1)mod2(nmod2j)]=j=0qsn(n)2j-i=1sn2qi(n)-j=0qsn(n)i:qi(n)<j2qi(n)+2j=1sni=1j-12qi(n)=2qsn(n)+1-1-n-i=1sn2qi(n)(qsn(n)-qi(n))+2i=1sn2qi(n)(sn-i)=2qsn(n)+1-1-n-i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i))

Using this expression to compute a2n−1 (and taking into account that s2n = sn and qi(2n) = qi(n) + 1 for i = 1, …, sn) we obtain

a2n-1=2qsn(n)+2-1-2n-2i=1sn-12qi(n)(qsn(n)-qi(n)-2(sn-i))

That is, xn = a2n−1, which is not self-evident from the definitions of both sequences.

Remark 1. The solution of

xn=a·xn/2+a·xn/2+(n/2-n/2)

and of

xn=a·xn/2+a·xn/2+(n/2-n/2)m

for m ⩾ 1, is the same. Therefore, for every m ⩾ 1,

x(1,0)(a)-x(0,1)(a)=p=0m(mp)(-1)m-px(p,m-p)(a)

Remark 2. The solution of Eq (1) is 0 exactly when x1 = 0 and p(n) = 0 for every n ⩾ 1. Writing p(n) = P(⌈n/2⌉, ⌊n/2⌋) with P(x,y)R[x,y], this says that P(m, m) = P(m + 1, m) = 0 for every m ⩾ 1 and hence that the polynomials P(x, x) and P(x, x − 1) are identically 0, that is, P(x, y) = (xy)(xy − 1)Q(x, y) for some Q(x,y)R[x,y]. So, xn = 0 for every n ⩾ 1 when x1 = 0 and the independent term has the form

p(n)=(n/2-n/2)(n/2-n/2-1)Q(n/2,n/2)

with Q(x,y)R[x,y].

Writing P(x,y)=k=0dr=0kbr,k-rxryk-r the conditions P(x, x) = P(x, x − 1) = 0 are equivalent to the following identities: for every k = 0, …, d,

j=0kbj,k-j=0,l=1d-kj=0k(l+jj)bl+j,k-j=0 (4)

We deduce that if the coefficients br,t satisfy Eq (4), and only in this case,

r,t0br,tx(r,t)(a)=0.

This generalizes the identity obtained at the end of the previous remark.

Example 5. The sequence xn = n2 satisfies the equation

xn=2xn/2+2xn/2+n/2-n/2

with x1 = 1. Therefore,

xn=xn(0,1)(2)-xn(1,0)(2)+3n2qsn(n)-2·4qsn(n)

Now,

xn(0,1)(2)=αn(0,0)(2)+13(3n·2qsn(n)-2·4qsn(n)-1)xn(1,0)(2)=-n+1+23(3n·2qsn(n)-2·4qsn(n)-1)-αn(0,0)(2)

and

αn(0,0)(2)=12i=1snMi(n)((2qi(n)-1)-(2qi(n)-1-1))+i=1sn-12qi(n)(n-Mi(n))-4qi(n)-13=12i=1snMi(n)(2qi(n)-2qi-1(n))+i=1sn2qi(n)(n-Mi(n))-13(3n2qsn(n)-2·4qsn(n)-1)=n2-12i=1snMi(n)2qi(n)-12i=1snMi(n)2qi-1(n)-13(3n2qsn(n)-2·4qsn(n)-1)=n2-12i=1snMi(n)2qi(n)-12i=0snMi+1(n)2qi(n)-13(3n2qsn(n)-2·4qsn(n)-1)=n2-12i=1sn2qi(n)(Mi(n)+Mi+1(n))-12n-13(3n2qsn(n)-2·4qsn(n)-1)=n2-12i=1sn(Mi(n)-Mi+1(n))(Mi(n)+Mi+1(n))-12n-13(3n2qsn(n)-2·4qsn(n)-1)=n2-12i=1sn(Mi(n)2-Mi+1(n)2)-12n-13(3n2qsn(n)-2·4qsn(n)-1)=12n2-12n-13(3n2qsn(n)-2·4qsn(n)-1)

and therefore

xn=αn(0,0)(2)+13(3n·2qsn(n)-2·4qsn(n)-1)-(-n+1+23(3n·2qsn(n)-2·4qsn(n)-1)-αn(0,0)(2))+3n2qsn(n)-2·4qsn(n)=2αn(0,0)(2)+23(3n·2qsn(n)-2·4qsn(n)-1)+n=n2-n-23(3n2qsn(n)-2·4qsn(n)-1)+23(3n·2qsn(n)-2·4qsn(n)-1)+n=n2

indeed.

Example 6. The Walsh system is a complete orthogonal set of functions that can represent any discrete function in the same sense that trigonometric functions represent any continuous function in Fourier analysis [38]. More specifically, if rn(t) = sgn(sin(2nπt)), nN, are the Rademacher functions, then the Walsh system W=(Wk:[0,1]{-1,1})kN is defined as follows: for every t ∈ [0, 1]

W0(t)=1,W2k+i(t)=rn+1(t)Wi(t),k0,0i2k-1.

Given an orthogonal system of functions φ=(φn)nN defined on [a, b] and satisfying some technical conditions that are satisfied by the Walsh system [39], the Lebesgue constants λn(φ) of φ are defined as

λn(φ)=01|j=1nφj(t)|dt,

and they are an important characteristic of φ.

The sequence λnλn(W) of Lebesgue constants of the Walsh system turns out to satisfy the recurrence

λn=12λn/2+12λn/2+12n2-12n2

with λ1 = 1 [39, 40]. Therefore,

λn=12xn(1,0)(1/2)-12xn(0,1)(1/2)+1

where

xn(1,0)(1/2)=2n-qsn(n)-n·2-qsn(n)-1-αn(0,0)(1/2)xn(0,1)(1/2)=αn(0,0)(1/2)+qsn(n)+n·2-qsn(n)-1αn(0,0)(1/2)=12i=1snMi(n)(T(0,qi(n),1/2)-T(0,qi-1(n),1/2))+i=1sn-12-qi(n)(n-Mi(n))-qsn(n)=i=1snMi(n)(2-qi-1(n)-2-qi(n))+i=1sn-12-qi(n)(n-Mi(n))-qsn(n)=i=1snMi(n)2-qi-1(n)-i=1snMi(n)2-qi(n)+i=1sn-12-qi(n)(n-Mi(n))-qsn(n)=i=0snMi+1(n)2-qi(n)-i=1snMi(n)2-qi(n)+i=1sn-12-qi(n)(n-Mi(n))-qsn(n)=n+i=1sn(Mi+1(n)-Mi(n))2-qi(n)+i=1sn-12-qi(n)(n-Mi(n))-qsn(n)=n-i=1sn2qi(n)2-qi(n)+i=1sn-12-qi(n)(n-Mi(n))-qsn(n)=n-sn+i=1sn-12-qi(n)(n-Mi(n))-qsn(n)

Therefore,

λn=12(2n-qsn(n)-n·2-qsn(n)-1-αn(0,0)(1/2))-12(αn(0,0)(1/2)+qsn(n)+n·2-qsn(n)-1)+1=-αn(0,0)(1/2)+n-qsn(n)-n·2-qsn(n)+1=-n+sn-i=1sn-12-qi(n)(n-Mi(n))+qsn(n)+n-qsn(n)-n·2-qsn(n)+1=sn-i=1sn2-qi(n)(n-Mi(n))

in agreement with [39, Eqn. (5.5)], where this formula is obtained through an ad hoc argument.

Remark 3. As R. Stephan points out in [1], the OEIS contains many sequences defined by recurrences of the form

{a2n=C·an+C·an-1+P(n)a2n+1=2C·an+Q(n)

for some real number C and functions P, Q. It is straightforward to check then that the sequence xnan−1 satisfies, for n ⩾ 2, the recurrence (cf. [31])

xn=C·xn/2+C·xn/2+Q(n/2-1)+(n/2-n/2)(P(n/2)-Q(n/2-1)).

If P and Q are polynomials, these sequences are covered by our main theorem.

Example 7. In [41], Stanton, Kocay, and Dirksen introduced the sequence an=k=1ni=1sk(-1)qi(n) (sequence A005536). This sequence is generated by the first Feigenbaum symbolic sequence, of importance in symbolic dynamics [42]. By the second last entry in the last table of [1] and the last remark, the sequence xn = an−1, for n ⩾ 1, satisfies the recurrence

xn=-xn/2-xn/2+n/2

with x1 = 0. Hwang, Janson, and Tsai used this recurrence to obtain the following expression for xn:

f(t)=n(14+(-1)sn2(12-21-sn3)+(-1)snj0(-1)j2-j-t+tg¯(2j+t-t))

where, for every k ⩾ 1, g¯(k)=(1-x+x)/2 if ⌊x⌋ is even and g¯(k)=(x-x)/2 if ⌊x⌋ is odd; see [31, Ex 7.1].

Our method produces a simpler expression for xn. Indeed, by our main theorem,

xn=xn(0,1)(-1)

where

xn(0,1)(-1)=αn(0,0)(-1)-13((-2)qsn(n)-1)+(-1)qsn(n)n-(-2)qsn(n)=αn(0,0)(-1)-43·(-2)qsn(n)+13+(-1)qsn(n)n
αn(0,0)(-1)=12i=1snMi(n)(T(0,qi(n),-1)-T(0,qi-1(n),-1))+i=1sn-1(-1)qi(n)(n-Mi(n))-T(0,qsn(n),-2)=14i=1snMi(n)((-1)qi-1(n)-(-1)qi(n)))+i=1sn-1(-1)qi(n)(n-Mi(n))+13((-2)qsn(n)-1)=14i=1snMi(n)(-1)qi-1(n)-14i=1snMi(n)(-1)qi(n))+i=1sn-1(-1)qi(n)(n-Mi(n))+13((-2)qsn(n)-1)=14i=0snMi+1(n)(-1)qi(n)-14i=1snMi(n)(-1)qi(n)+i=1sn-1(-1)qi(n)(n-Mi(n))+13((-2)qsn(n)-1)=14n-14i=1sn(-2)qi(n)+i=1sn-1(-1)qi(n)(n-Mi(n))+13((-2)qsn(n)-1)

and hence

xn=14n-14i=1sn(-2)qi(n)+i=1sn-1(-1)qi(n)(n-Mi(n))+13((-2)qsn(n)-1)-43·(-2)qsn(n)+13+(-1)qsn(n)n=14n-14i=1sn(-2)qi(n)+i=1sn(-1)qi(n)(n-Mi(n))=14n-14i=1sn(-2)qi(n)+i=1sn((-1)qi(n)j=1i-12qj(n))=14i=1sn2qi(n)(1-(-1)qi(n)+4j=i+1sn(-1)qj(n))

Example 8. The minimum total cophenetic index Φn (see the Introduction for the definition) of a rooted bifurcating tree with n leaves (sequence A174605) satisfies the recurrence

Φn=Φn/2+Φn/2+(n/22)+(n/22)=Φn/2+Φn/2+12n22-12n2+12n22-12n2

with initial condition Φ1 = 0 [12]. Therefore

Φn=12(xn(2,0)(1)+xn(0,2)(1)-xn(1,0)(1)-xn(0,1)(1))=12(xn(2,0)(1)+xn(0,2)(1)-Sn)

where

Sn=xn(1,0)(1)+xn(0,1)(1)=(qsn(n)+2)n-2qsn(n)+1

was already computed in Example 2 and

xn(2,0)(1)=n2+(qsn(n)-2)n+3-2qsn(n)+1-3αn(0,0)(1)-αn(0,1)(1)xn(0,2)(1)=αn(0,0)(1)+αn(0,1)(1)+n-1

Therefore

Φn=12(n2+(qsn(n)-2)n+3-2qsn(n)+1-3αn(0,0)(1)-αn(0,1)(1)+αn(0,0)(1)+αn(0,1)(1)+n-1-((qsn(n)+2)n-2qsn(n)+1))=12(n2-3n+2-2αn(0,0)(1))=(n-12)-(snn+i=1sn2qi(n)-1(qi(n)-2i)-n+1)(byEqn.(3))=(n2)-snn-i=1sn2qi(n)-1(qi(n)-2i)

No closed expression had been published so far for this sequence.

Example 9. The maximum rooted quartet index ρn (see again the Introduction for the definition) of a rooted bifurcating tree with n leaves (sequence A300445) satisfies the recurrence

ρn=ρn/2+ρn/2+(n/22)(n/22)=ρn/2+ρn/2+14(n2n2-n22n2-n2n22+n22n22)

with initial condition ρ1 = 0 [17]. Therefore

ρn=14(xn(1,1)(1)-xn(2,1)(1)-xn(1,2)(1)+xn(2,2)(1))

where

xn(1,1)(1)=12n2+(1+B1-1)n+(1-0-1)αn(0,0)(1)+(1-1-0)αn(0,1)(1)=(n2)xn(2,1)(1)=k=23(j=k3(2j-2)(jk)Bj-kj(2j-1-1))nk+(1+l=12(2l-1)(Bl-1)2l-1)n+l=01(2l)21+l-1-1+i=02(2-i(3i)-2-i+1(2i-1)-l=i1(2l)(1+li)21+l-1)αn(0,i)(1)=29n3+16n2-1918n+23-23αn(0,0)(1)-56αn(0,1)(1)-14αn(0,2)(1)
xn(1,2)=k=23(j=k3(1j-3)(jk)Bj-kj(2j-1-1))nk+(1+l=12(1l-2)(Bl-1)2l-1)n+l=00(1l)22+l-1-1+i=02(2-i(3i)-2-i+1(1i-2)-l=i-10(1l)(2+li)22+l-1)αn(0,i)(1)=19n3-16n2+1318n-23+23αn(0,0)(1)+56αn(0,1)(1)+14αn(0,2)(1)xn(2,2)=k=24(j=k4(2j-3)(jk)Bj-kj(2j-1-1))nk+(1+l=13(2l-2)(Bl-1)2l-1)n+l=01(2l)22+l-1-1+i=03(2-i(4i)-2-i+1(2i-2)-l=i-11(2l)(2+li)22+l-1)αn(0,i)(1)=114n4-263n3-221n2+55126n-821+821αn(0,0)(1)+1021αn(0,1)(1)+17αn(0,2)(1)

Therefore,

ρn=14[(n2)-(29n3+16n2-1918n+23-23αn(0,0)(1)-56αn(0,1)(1)-14αn(0,2)(1))-(19n3-16n2+1318n-23+23αn(0,0)(1)+56αn(0,1)(1)+14αn(0,2)(1))+(114n4-263n3-221n2+55126n-821+821αn(0,0)(1)+1021αn(0,1)(1)+17αn(0,2)(1))]=1504[(n-3)(n-2)(n-1)(9n+8)+48αn(0,0)(1)+60αn(0,1)(1)+18αn(0,2)(1)] (5)

Now,

αn(0,0)(1)=12i=1snMi(n)(qi(n)-qi-1(n))+i=1sn-1(n-Mi(n))-2qsn(n)+1(byEqn.(2))=12i=1snMi(n)(qi(n)-qi-1(n))+i=1sn(n-Mi(n))-n+1αn(0,1)(1)=14i=1sn(Mi(n)2(T(0,qi(n),1/2)-T(0,qi-1(n),1/2))+4B1Mi(n)(qi(n)-qi-1(n)))+i=1sn-12-qi(n)(n-Mi(n))Mi+1(n)=12i=1snMi(n)2(2-qi-1(n)-2-qi(n))-12i=1snMi(n)(qi(n)-qi-1(n))+i=1sn2-qi(n)Mi+1(n)
αn(0,2)(1)=16i=1sn(Mi(n)3(T(0,qi(n),1/4)-T(0,qi-1(n),1/4))+6B1Mi(n)2(T(0,qi(n),1/2)-T(0,qi-1(n),1/2))+12B2Mi(n)(qi(n)-qi-1(n)))+i=1sn-14-qi(n)(n-Mi(n))Mi+1(n)2=29i=1snMi(n)3(4-qi-1(n)-4-qi(n))-i=1snMi(n)2(2-qi-1(n)-2-qi(n))+13i=1snMi(n)(qi-qi-1)+i=1sn4-qi(n)Mi+1(n)2(n-Mi(n))

and then, substituting these expressions in Eq (5), we finally obtain

ρn=1252[3(9n+8)(n-13)-24n+24+2i=1snMi(n)3(4-qi-1(n)-4-qi(n))+6i=1snMi(n)2(2-qi-1(n)-2-qi(n))+i=1sn(n-Mi(n))(24+30·2-qi(n)Mi+1(n)+9·4-qi(n)Mi+1(n)2)]

This expression can be simplified as follows. Notice that

2i=1snMi(n)3(4-qi-1(n)-4-qi(n))+6i=1snMi(n)2(2-qi-1(n)-2-qi(n))=2(i=0snMi+1(n)34-qi(n)-i=1snMi(n)34-qi(n))+6(i=0sn-1Mi+1(n)22-qi(n)-i=1snMi(n)22-qi(n))=2n3+2i=1sn4-qi(n)(Mi+1(n)3-Mi(n)3)+6n2+6i=1sn2-qi(n)(Mi+1(n)2-Mi(n)2)=2n3+6n2+2i=1sn4-qi(n)(-3Mi(n)22qi(n)+3Mi(n)4qi(n)-8qi(n))+6i=1sn2-qi(n)(-2Mi(n)2qi(n)+4qi(n))=2n3+6n2-2i=1sn(3Mi(n)22-qi(n)+3Mi(n)-2·2qi(n))=2n3+6n2+4n-6i=1snMi(n)(Mi(n)2-qi(n)+1)

and

i=1sn(n-Mi(n))(24+30·2-qi(n)Mi+1(n)+9·4-qi(n)Mi+1(n)2)=i=1sn(n-Mi(n))(24+30·2-qi(n)(Mi(n)-2qi(n))+9·4-qi(n)(Mi(n)-2qi(n))2)=i=1sn(n-Mi(n))(3+12·2-qi(n)Mi(n)+9·4-qi(n)Mi(n)2)=3ni=1sn(1+4·2-qi(n)Mi(n)+3·4-qi(n)Mi(n)2)-3i=1snMi(n)(1+4·2-qi(n)Mi(n)+3·4-qi(n)Mi(n)2)

and hence, finally

ρn=1252[3(9n+8)(n-13)-24n+24+2n3+6n2+4n-6i=1snMi(n)(Mi(n)2-qi(n)+1)+3ni=1sn(1+4·2-qi(n)Mi(n)+3·2-2qi(n)Mi(n)2)-3i=1snMi(n)(1+4·2-qi(n)Mi(n)+3·2-2qi(n)Mi(n)2)]=1504[9n4-42n3+63n2-6n+6ni=1sn(1+Mi(n)2-qi(n))(1+3Mi(n)2-qi(n))-18i=1snMi(n)(1+Mi(n)2-qi(n))2]

where notice that Mi(n)2qi(n)=n/2qi(n). Again, no closed expression was known so far for this sequence, either.

Example 10. Let a1,n, a2,n, and a3,n denote the sequences A006581, A006582, and A006583, respectively. They are defined as

a1,n=k=1n-1(kAND(n-k)),a2,n=k=1n-1(kXOR(n-k)),a3,n=k=1n-1(kOR(n-k))

where the bitwise operations AND, XOR, and OR are performed on the binary representations of the numbers. For instance,

a1,5=k=14(kAND(n-k))=(1AND4)+(2AND3)+(3AND2)+(4AND1)=(001AND100)+(010AND011)+(011AND010)+(100AND001)=000+010+010+000=0+2+2+0=4a2,5=k=14(kXOR(n-k))=(1XOR4)+(2XOR3)+(3XOR2)+(4XOR1)=(001XOR100)+(010XOR011)+(011XOR010)+(100XOR001)=101+001+001+101=5+1+1+5=12a3,5=k=14(kOR(n-k))=(1OR4)+(2OR3)+(3OR2)+(4OR1)=(001OR100)+(010OR011)+(011OR010)+(100OR001)=101+011+011+101=5+3+3+5=16

To our knowledge, no explicit formulas for these sequences had been published so far. On the other hand, it is clear from the definition that a1,n + a2,n = a3,n, and therefore it is enough to obtain explicit formulas for two of them. We shall focus here on a1,n and a3,n.

By Remark 3, the sequences σi,n = ai,n−1, for i = 1, 3, are the solutions with σ1,1 = σ3,1 = 0 of the recurrences

σi,n=2σi,n/2+2σi,n/2+gi(n)

where

g1(n)=n2(n2-n2)=n2n2-n22g3(n)=6(n2-1)+(n2-n2)(5n2-4-6n2+6)=4n2+2n2-6-g1(n)

Therefore,

σ1,n=xn(1,1)(2)-xn(0,2)(2)σ3,n=4xn(0,1)(2)+2xn(1,0)(2)-6xn(0,0)(2)-σ1,n

where

xn(0,0)(2)=13(3n·2qsn(n)-2·4qsn(n)-1)(cf.Example1)xn(0,1)(2)=αn(0,0)(2)+xn(0,0)(2)xn(0,2)(2)=αn(0,0)(2)+αn(0,1)(2)+xn(0,0)(2)xn(1,0)(2)=-n+23(3n·2qsn(n)-2·4qsn(n)-1)+1-αn(0,0)(2)=2xn(0,0)(2)-n+1-αn(0,0)(2)xn(1,1)(2)=k=12(j=kj22(1j-2)(jk)Bj-kj(2j-1-2))nk+12((qsn(n)-1)4qsn(n)+1-qsn(n)4qsn(n)+49+nqsn(n)2qsn(n)-qsn(n)4qsn(n))+(1-l=0l00(1l)21+l-2)13(3n·2qsn(n)-2·4qsn(n)-1)+i=01(2-i(2i)-2-i+1(1i-1)-l=il00(1l)(1+li)21+l-2)αn(0,i)(2)+12i=00(1i)αn(1,i)(a)=118(9nqsn(n)2qsn(n)-6qsn(n)4qsn(n)-4·4qsn(n)+4)+13(3n·2qsn(n)-2·4qsn(n)-1)+αn(0,0)(2)+12αn(1,0)(2)

and

αn(0,0)(2)=12i=1snMi(n)(T(0,qi(n),2)-T(0,qi-1(n),2))+i=1sn-12qi(n)(n-Mi(n))-T(0,qsn(n),4)=12i=1snMi(n)(2qi(n)-2qi-1(n))+i=1sn-12qi(n)(n-Mi(n))-13(4qsn(n)-1)αn(0,1)(2)=14i=1snMi(n)2(qi(n)-qi-1(n))-12i=1snMi(n)(2qi(n)-2qi-1(n))+i=1sn-1(n-Mi(n))Mi+1(n)αn(1,0)(2)=12i=1snMi(n)(T(1,qi(n),2)-T(1,qi-1(n),2))+i=1sn-1qi(n)2qi(n)(n-Mi(n))-T(1,qsn(n),4)=12i=1snMi(n)((qi(n)-2)2qi(n)-(qi-1(n)-2)2qi-1(n))+i=1sn-1qi(n)2qi(n)(n-Mi(n))-19((3qsn(n)-4)4qsn(n)+4)

Therefore, finally,

σ1,n=xn(1,1)(2)-xn(0,2)(2)=118(9nqsn(n)2qsn(n)-6qsn(n)4qsn(n)-4·4qsn(n)+4)+13(3n·2qsn(n)-2·4qsn(n)-1)+αn(0,0)(2)+12αn(1,0)(2)-αn(0,0)(2)-αn(0,1)(2)-13(3n·2qsn(n)-2·4qsn(n)-1)=118(9nqsn(n)2qsn(n)-6qsn(n)4qsn(n)-4·4qsn(n)+4)+12αn(1,0)(2)-αn(0,1)(2)=118(9nqsn(n)2qsn(n)-6qsn(n)4qsn(n)-4·4qsn(n)+4)+14i=1snMi(n)((qi(n)-2)2qi(n)-(qi-1(n)-2)2qi-1(n))+12i=1sn-1qi(n)2qi(n)(n-Mi(n))-118(3qsn(n)4qsn(n)-4·4qsn(n)+4)-14i=1snMi(n)2(qi(n)-qi-1(n))+12i=1snMi(n)(2qi(n)-2qi-1(n))-i=1sn-1(n-Mi(n))Mi+1(n)=12(nqsn(n)2qsn(n)-qsn(n)4qsn(n))+14i=1snMi(n)(qi(n)2qi(n)-qi-1(n)2qi-1(n))-14i=1snMi(n)2(qi(n)-qi-1(n))+12i=1sn-1qi(n)2qi(n)(n-Mi(n))-i=1sn-1(n-Mi(n))Mi+1(n)=14i=1snMi(n)(qi(n)2qi(n)-qi-1(n)2qi-1(n))-14i=1snMi(n)2(qi(n)-qi-1(n))+12i=1snqi(n)2qi(n)(n-Mi(n))-i=1sn(n-Mi(n))Mi+1(n)=14i=1snMi(n)qi(n)(2qi(n)-Mi(n))+14i=1snMi(n)qi-1(n)(Mi(n)+2qi-1(n))-12i=1snMi(n)qi-1(n)2qi-1(n)+12i=1snqi(n)2qi(n)(n-Mi+1(n)-2qi(n))-i=1sn(n-Mi(n))Mi+1(n)=-14i=1snMi(n)qi(n)Mi+1(n)+14i=1snMi(n)qi-1(n)Mi-1(n)-12i=0snMi+1(n)qi(n)2qi(n)-12i=1snqi(n)2qi(n)Mi+1(n)+12i=1snqi(n)2qi(n)(n-2qi(n))-i=1sn(n-Mi(n))Mi+1(n)=-14i=1snMi(n)qi(n)Mi+1(n)+14i=0sn-1Mi+1(n)qi(n)Mi(n)-i=1snqi(n)2qi(n)Mi+1(n)+12i=1snqi(n)2qi(n)(n-2qi(n))-i=1sn(n-Mi(n))Mi+1(n)=12i=1snqi(n)2qi(n)(n-2qi(n)-2Mi+1(n))-i=1sn(n-Mi(n))Mi+1(n)

and

σ3,n=4xn(0,1)(2)+2xn(1,0)(2)-6xn(0,0)(2)-σ1,n=4(αn(0,0)(2)+xn(0,0)(2))+2(2xn(0,0)(2)-n+1-αn(0,0)(2))-6xn(0,0)(2)-σ1,n=2αn(0,0)(2)+2xn(0,0)(2))-2n+2-σ1,n=i=1snMi(n)(2qi(n)-2qi-1(n))+2i=1sn-12qi(n)(n-Mi(n))-23(4qsn(n)-1)+23(3n·2qsn(n)-2·4qsn(n)-1)-2n+2-σ1,n=i=1snMi(n)(2qi(n)-2qi-1(n))+2i=1sn2qi(n)(n-Mi(n))-2n+2-σ1,n=-i=1snMi(n)2qi-1(n)+n2+i=1sn2qi(n)(n-Mi(n))-2n+2-σ1,n=2(n-12)-σ1,n

Therefore,

a1,n=12i=1sn+1qi(n+1)2qi(n+1)(n+1-2qi(n+1)-2Mi+1(n+1))-i=1sn+1(n+1-Mi(n+1))Mi+1(n+1)a3,n=2(n2)-a1,na2,n=a3,n-a1,n=2(n2)-2a1,n

Example 11. Notice that x2m(r,t)=2ax2m-1(r,t)+2(m-1)(r+t) and therefore, since x1(r,t)=0,

x2m(r,t)(a)=k=0m-1(2a)k2(r+t)(m-k-1)=2(r+t)(m-1)k=0m-1(2-r-t+1a)k=2(r+t)(m-1)T(0,m,2-r-t+1a)={2(r+t)(m-1)mifa=2r+t-1,i.e.,if=r-1(2a)m-2m(r+t)2a-2r+tifa2r+t-1

We have checked that our general formula for xn(r,t)(a) satisfies this equality when n = 2m with Mathematica.

Proof of the main result

Some notations

1. Throughout this paper we shall use the following notations related to binary decompositions of natural numbers. For every nN, we shall write its binary decomposition as

n=j=1sn2qj(n),with0q1(n)<<qsn(n);

if n = 0, we set s0 = 0. With these notations, sn is the binary weight of n, that is, the number of 1’s in the binary representation of n, and, if n ⩾ 1, qsn(n)=log2(n). In order to simplify the notations, we shall set q0(n) = 0.

Notice that, for every MN2 and for every natural number 1p<2q1(M),

M+p=i=1sp2qi(p)+i=1sM2qi(M)

is the binary decomposition of M + p, with 0q1(p)<<qsp(p)<q1(M)<<qsM(M), and hence sM + p = sp + sM and

qj(M+p)={qj(p)forj=1,,spqj-sp(M)forj=sp+1,,sM+p (6)

For every nN and i = 1, …, sn, let

Mi(n)=j=isn2qj(n)=2qi(n)n2qi(n).

2. For every nN, let φ0(n) = ⌊n/2⌋ and φ1(n) = ⌈n/2⌉ and, for every m ⩾ 1 and for every sequence bmb0 ∈ {0, 1}m + 1, let

φbmb0(n)=φbm(φbm-1b0(n)).

By Thompson’s Rounding Lemma [43], for every sequence bmb0 ∈ {0, 1}m + 1,

φbmb0(n)=n+i=0mbi2i2m+1. (7)

3. For every mN, let Bm denote the m-th Bernoulli number of the first kind. Recall that these Bernoulli numbers can be defined, starting with B0 = 1, by means of the recurrence

k=0m(m+1k)Bk=0,m1. (8)

Let moreover Bm(x)Q[x] be the Bernoulli polynomial of degree m, defined by

Bm(x)=k=0m(mk)Bkxm-k.

We list below several well-known properties of the Bernoulli numbers and polynomials that we shall use in our proofs, frequently without any further notice. For these and other properties of the Bernoulli numbers and polynomials, see for instance [44, Ch. 23].

B1=-1/2andB2i+1=0foreveryi1 (9)
Bm=Bm(0)=(-1)mBm(1) (10)
Bm(x+y)=k=0m(mk)Bk(x)ym-k (11)

In particular,

Bm(2)=Bm(1+1)=k=0m(mk)Bk(1)(by(11))=k=0m(mk)(-1)kBk(by(10))=k=0m(mk)Bk-2mB1=k=0m(mk)Bk+m(by(9))=Bm(1)+m=(-1)mBm+m(againby(10)) (12)

4. For every dN, nN1, and xR\{0}, let

T(d,n,x)=k=0n-1kdxk

The value of T(d, n, 1) is given by Faulhaber’s formula [29, (6.78)]: for every dN and nN1,

k=0n-1kd=1d+1j=0d(d+1j)Bjnd+1-j

We shall also use this formula in the following, equivalent way:

k=1n-1kd=1d+1(j=0d+1(d+1j)Bjnd+1-j+(-1)dBd+1) (13)

The equivalence stems from the fact that if d ⩾ 1, (−1)d Bd + 1 = −Bd + 1, while when d = 0, (−1)d Bd + 1 = B1 = −1/2.

When x ≠ 1, the double sequence T satisfies the recurrence

T(d,n,x)=x1-xp=0d-1(dp)T(p,n,x)-xn1-xnd,d1.

In particular, when x ≠ 1,

T(1,n,x)=x1-x(T(0,n,x)-nxn-1) (14)

We shall use these double sequences T(d, n, x) in order to unify some notations and proofs, but, as we have already encountered in the statement of our main result, we actually only need to know closed formulas for them when d = 0, 1:

T(0,n,1)=n,T(0,n,x)=xn-1x-1forx1T(1,n,1)=(n2),T(1,n,x)=nxn(x-1)-x(xn-1)(x-1)2forx1 (15)

Some technical lemmas

We begin by providing closed formulas for several sums that we shall often encounter in our computations.

Lemma 4. For every dN, nN1, and xR\{0}:

  • (a) k=1n-1qsk(k)dxqsk(k)=T(d,qsn(n),2x)+nqsn(n)dxqsn(n)-qsn(n)d(2x)qsn(n)

  • (b) k=0n-1i=1skqi(k)dxqi(k)=i=1sn2qi(n)-1T(d,qi(n),x)+i=1snqi(n)dxqi(n)(n-Mi(n))

The next lemma is a key step in the obtention of finite explicit expressions for the solutions of the recurrences considered in this paper.

Lemma 5. Let (zl,p)(l,p)N2 be a double sequence satisfying:

  • (a) For every pN , z0,p = 0

  • (b) For every l, p > 0,
    zl,p=2zl-1,p+q=0p-1(pq)2(p-q)(l-1)zl-1,q

Then, for every l ⩾ 0 and for every p > 0,

zl,p=-2lp+1j=1l-1(i=1p(p+1i)(2i-1)2(p-i)l+(i-1)jBi)zj,0.

For every l,m,p,dN, with p < m, and for every given aR\{0}, let

γl(d,p,m)=k=12l-1i=1skqi(k)d(2-ma)qi(k)Mi+1(k)p

In the last part of our computations we shall use an alternative expression for γl(d,p,m) which we derive now as an application of the last lemma.

We have that γ0(d,p,m)=0 by definition, and, by Lemma 4.(b),

γl(d,0,m)=k=12l-1i=1skqi(k)d(a2-m)qi(k)=2l-1T(d,l,a2-m) (16)

The case when l, p > 0 is covered by the next lemma.

Lemma 6. For every l,m,p,dN, with p < m,

γl(d,p,m)=al-12-(m-1)(l-1)+plp+1t=1l-1(l-t-1)d(a-12m-p-1)t(Bp+1(2t)-Bp+1)+(a2-(m-1))l-1(l-1)d·δp=0,l>0

where δp = 0, l > 0 = 1 if p = 0 and l > 0, and δp = 0, l > 0 = 0 otherwise.

Statement of the problem

Let P(x,y)=r,t0br,txrytR[x,y] be a bivariate polynomial and aR\{0}, and consider the recurrence equation

xn=a·xn/2+a·xn/2+P(n/2,n/2),n2. (17)

Lemma 7. If (xn0)n is the solution of (17) with initial condition x10=0, then

x¯n=xn0+((2a)qsn(n)+(2a-1)(naqsn(n)-(2a)qsn(n)))x1

is its solution with initial condition x1

Proof. Since x¯1=x1, we must prove that (x¯n)n satisfies (17). Since (xn0)n already satisfies it, it is enough to check that, for every n ⩾ 2,

(2a)qsn(n)+(2a-1)(naqsn(n)-(2a)qsn(n))=a((2a)qsn/2(n/2)+(2a-1)(n/2aqsn/2(n/2)-(2a)qsn/2(n/2)))+a((2a)qsn/2(n/2)+(2a-1)(n/2aqsn/2(n/2)-(2a)qsn/2(n/2)))

The simplest way to do it is by distinguishing two cases; to simplify the notations, we denote in the rest of this proof qsn(n) by q.

  • (i) If n ≠ 2q + 1 − 1, then qsn/2(n/2)=qsn/2(n/2)=q-1 and then
    a((2a)q-1+(2a-1)(n/2aq-1-(2a)q-1)+(2a)q-1+(2a-1)(n/2aq-1-(2a)q-1))=a(2(2a)q-1+(2a-1)(naq-1-2(2a)q-1))=(2a)q+(2a-1)(naq-(2a)q)
  • (ii) If n = 2q + 1 − 1, then ⌈n/2⌉ = 2q and ⌊n/2⌋ = 2q − 1, and then
    a((2a)q+(2a-1)(2qaq-(2a)q)+(2a)q-1+(2a-1)((2q-1)aq-1-(2a)q-1))=2q+1aq+1-(2a-1)aq=(2a)q+(2a-1)((2q+1-1)aq-(2a)q)

Remark 8. In particular, if p = 0, the solution of (17) with initial condition x1 is

xn=((2a)qsn(n)+(2a-1)(naqsn(n)-(2a)qsn(n)))x1,

as it was already proved in [30, Lem. 21].

Therefore, from now on we shall only be concerned with the solution of (17) with initial condition x1 = 0. Now, if, for every (r,t)N2 such that br,t ≠ 0, we know the solution (xn(r,t))n of the recurrence

xn(r,t)=a·xn/2(r,t)+a·xn/2(r,t)+n2r·n2t,n2, (18)

with initial condition x1(r,t)=0, then the solution of (17) with initial condition x1 = 0 will be

xn=r,tbr,txn(r,t).

So, we are finally led to consider, for any r,tN, the equation (18). Let xn(r,t) be its solution with x1(r,t)=0.

The sequence of differences of consecutive terms yn(r,t)

Let yn(r,t)=xn(r,t)-xn-1(r,t), with y1(r,t)=0, and

xn(r,t)=k=1nyk(r,t). (19)

Notice that

y2(r,t)=x2(r,t)-x1(r,t)=a·x1(r,t)+a·x1(r,t)+1-x1(r,t)=1.

Next result gives an expression for yn(r,t) that will be suitable to our purposes. To simplify the notations, in its statement and henceforth, for every d,m,nN, we set

Sn(d,m)=j=1sn-1qj(n)d(2-ma)qj(n)Mj+1(n)m.

Moreover, we shall let = log2(a) − t when a > 0, and we shall use the following Kronecker delta:

δ={1ifa>0,r>0,and{0,,r-1}0otherwise

Proposition 9. For every n ⩾ 2,

yn(r,t)=aqsn-1(n-1)+l=0lr-1(rl)2t+l-a((n-1)t+l-aqsn-1(n-1))+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1lr-1(rl)(t+li)2t+l-a)Sn-1(0,i)+δ·1a(r)j=0sn-1-1Mj+1(n-1)t+(qj+1(n-1)-qj(n-1))

Remark 10. When r = t = 0, the formula in the last proposition simply says yn(r,t)=aqsn-1(n-1).

In the expression for yn(r,t) given in the last proposition, the term

δ·1aj=0sn-1-1Mj+1(n-1)t+(qj+1(n-1)-qj(n-1))

is different from 0 only when r > 0 and a ∈ {2t, …, 2r + t−1}. When t + = 0, that is, when a = 1, the sum in it simplifies to

j=0sn-1-1Mj+1(n-1)0(qj+1(n-1)-qj(n-1))=qsn-1(n-1) (20)

And notice that this sum contributes in this a = 1 case to yn(r,t) only when r > 0 and a = 1 ∈ {2t, …, 2r + t−1}, that is, when r > 0 and t = 0. When t + > 0, and recalling that 2t + = a, this sum is

j=0sn-1-1Mj+1(n-1)t+(qj+1(n-1)-qj(n-1))=j=1sn-1-1qj(n-1)(Mj(n-1)t+-Mj+1(n-1)t+)+2(t+)qsn-1(n-1)qsn-1(n-1)=j=1sn-1-1qj(n-1)((Mj+1(n-1)+2qj(n-1))t+-Mj+1(n-1)t+)+aqsn-1(n-1)qsn-1(n-1)=aqsn-1(n-1)qsn-1(n-1)+j=1sn-1-1qj(n-1)i=0t+-1(t+i)Mj+1(n-1)i2qj(n-1)(t+-i)=aqsn-1(n-1)qsn-1(n-1)+i=0t+-1(t+i)j=1sn-1-1qj(n-1)Mj+1(n-1)i(a2-i)qj(n-1) (21)
=aqsn-1(n-1)qsn-1(n-1)+i=0t+-1(t+i)Sn-1(1,i) (22)

where, for every n,iN,

Sn(1,i)=j=1sn-1qj(n)(2-ia)qj(n)Mj+1(n)i.

Notice that when δ = 1 and a = 1, Eq (22) becomes Eq (20).

Proof of the main result, up to computing the α’s

For every d,n,mN,

αn(d,m)=k=1n-1Sk(d,m)=k=1n-1j=1sk-1qj(k)d(2-ma)qj(k)Mj+1(k)m

By Proposition 9 and Eq (19), we have

xn(r,t)=k=2nyk(r,t)=k=1n-1[aqsk(k)+δ·1a(r)j=0sk-1Mj+1(k)t+(qj+1(k)-qj(k))+l=0lr-1(rl)2t+l-a·kt+l-l=0lr-1(rl)2t+l-a·aqsk(k)+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1lr-1(rl)(t+li)2t+l-a)Sk(0,i)]=δ·1a(r)k=1n-1j=0sk-1Mj+1(k)t+(qj+1(k)-qj(k))+(1-l=0lr-1(rl)2t+l-a)(k=1n-1aqsk(k))+l=0lr-1(rl)2t+l-ak=1n-1kt+l+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1lr-1(rl)(t+li)2t+l-a)k=1n-1Sk(0,i)=δ·1a(r)k=1n-1j=0sk-1Mj+1(k)t+(qj+1(k)-qj(k))+(1-l=0lr-1(rl)2t+l-a)(k=1n-1aqsk(k))+l=0lr-1(rl)(t+l+1)(2t+l-a)(j=0t+l+1(t+l+1j)Bjnt+l+1-j+(-1)t+lBt+l+1)+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1lr-1(rl)(t+li)2t+l-a)αn(0,i)

(by Faulhaber’s Formula (13))

=δ·1a(r)k=1n-1j=0sk-1Mj+1(k)t+(qj+1(k)-qj(k))+(1-l=0lr-1(rl)2t+l-a)(k=1n-1aqsk(k))+k=1r+t(i=kit++1r+t(ri-t-1)(ik)Bi-ki(2i-1-a))nk+i=t+1it++1r+t(ri-t-1)i(2i-1-a)(Bi-(-1)iBi)+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1lr-1(rl)(t+li)2t+l-a)αn(0,i) (23)

because

l=0lr-1(rl)(t+l+1)(2t+l-a)(j=0t+l+1(t+l+1j)Bjnt+l+1-j+(-1)t+lBt+l+1)=l=0lr-1(rl)(t+l+1)(2t+l-a)(k=0t+l+1(t+l+1k)Bt+l+1-knk+(-1)t+lBt+l+1)=i=t+1it++1r+t(ri-t-1)i(2i-1-a)(k=0i(ik)Bi-knk-(-1)iBi)=k=0r+t(i=kit++1r+t(ri-t-1)(ik)Bi-ki(2i-1-a))nk-i=t+1it++1r+t(ri-t-1)i(2i-1-a)(-1)iBi=i=t+1it++1r+t(ri-t-1)i(2i-1-a)Bi+k=1r+t(i=kit++1r+t(ri-t-1)(ik)Bi-ki(2i-1-a))nk-i=t+1it++1r+t(ri-t-1)i(2i-1-a)(-1)iBi=k=1r+t(i=kit++1r+t(ri-t-1)(ik)Bi-ki(2i-1-a))nk+i=t+1it++1r+t(ri-t-1)i(2i-1-a)(Bi-(-1)iBi)

Now, in Eq (23) we have that, by Lemma 4,

k=1n-1aqsk(k)=T(0,qsn(n),2a)+naqsn(n)-(2a)qsn(n)={qsn(n)+n·2-qsn(n)-1ifa=1/2(2a)qsn(n)-12a-1+n·aqsn(n)-(2a)qsn(n)ifa1/2

and, by (9),

i=t+1it++1r+t(ri-t-1)i(2i-1-a)(Bi-(-1)iBi)={1/(a-1)ifr>0,t=0,a10otherwise

Concerning the first term of Eq (23), which only contributes to xn(r,t) when r > 0 and a = 2t+ with ∈ {0, …, r − 1}, by (22) and Lemma 4 this sum can be expressed as

k=1n-1j=0sk-1Mj+1(k)t+(qj+1(k)-qj(k))=k=1n-1(aqsk(k)qsk(k)+i=0t+-1(t+i)Sk(1,i))=k=1n-1aqsk(k)qsk(k)+i=0t+-1(t+i)k=1n-1Sk(1,i)=T(1,qsn(n),2a)+nqsn(n)aqsn(n)-qsn(n)(2a)qsn(n)+i=0t+-1(t+i)αn(1,i)

In summary, this proves the following theorem.

Theorem 11. For every n ⩾ 2,

xn(r,t)=(1-l=0lr-1(rl)2t+l-a)(T(0,qsn(n),2a)+naqsn(n)-(2a)qsn(n))+k=1r+t(i=kit++1r+t(ri-t-1)(ik)Bi-ki(2i-1-a))nk+1a-1·δr>0,t=0,a1+i=0r+t-1(2-i(r+ti)-2-i+1(ri-t)-l=i-t+1lr-1(rl)(t+li)2t+l-a)αn(0,i)+δ·1a(r)(T(1,qsn(n),2a)+nqsn(n)aqsn(n)-qsn(n)(2a)qsn(n)+i=0t+-1(t+i)αn(1,i))

where δr > 0, t = 0, a ≠ 1 = 1 if r > 0, t = 0, and a ≠ 1, and it is 0 otherwise.

It remains to compute the terms

αn(d,i)=k=1n-1j=1sk-1qj(k)d(2-ia)qj(k)Mj+1(k)i,d=0,1.

And notice that we only need to compute the α(1,i)’s when r ⩾ 1 and a = 2t+, for some ∈ {0, …, r − 1} with t + > 0. In particular, in the computation of α(1,i) we can assume that a ≠ 1, 1/2, in order to avoid discussing cases that are unrelevant for our main result.

Computation of the α’s

Recall that we are interested in closed formulas for αn(d,m) when d = 0 as well as when d = 1 and specific values of a which in particular exclude the cases a = 1, 1/2. Anyway, it is easier to prove a general expression for them.

Proposition 12. For every n ⩾ 1:

αn(d,m)=12(m+1)i=1snj=0m(m+1j)Bj2jMim+1-j(T(d,qi,a2j-m)-T(d,qi-1,a2j-m))+i=1sn-1qid(a2-m)qi(n-Mi)Mi+1m-T(d,qsn(n),2a)·δm=0

with δm = 0 = 1 if m = 0 and δm = 0 = 0 if m > 0.

Remark 13. Notice that the last proposition implies that

αn(0,0)={j=1sn2qj(n)-1(qj(n)-2Mj(n))+(sn-1)n+1ifa=1j=1sn-12-qj(n)(n-Mj(n))+n-qsn-snifa=1/2j=1sn-1aqj(n)(n-Mj(n))+12(a-1)(j=1sn(2a)qj(n)-n)-(2a)qsn(n)-12a-1ifa1,1/2

and, when a ≠ 1, 1/2,

αn(1,0)=i=1sn2qi(n)-1T(1,qi(n),a)+i=1sn-1qi(n)aqi(n)(n-Mi(n))-T(1,qsn(n),2a)=i=1sn-1qi(n)aqi(n)(n-Mi(n))+12(a-1)i=1sn(2a)qi(n)qi(n)-a2(a-1)2i=1sn(2a)qi(n)-12a-1(2a)qsn(n)qsn(n)+2a(2a-1)2(2a)qsn(n)+a2(a-1)2n-2a(2a-1)2

Discussion and conclusions

Divide-and-conquer dividing by a half recurrences like (1) appear in many areas of applied mathematics, and they are usually “solved” by computing a bound for their growing order with the aid of a Master Theorem. This is usually enough in many applications, like for instance the asymptotic analysis of algorithms, but in other applications it may be necessary, or at least satisfactory, to obtain an explicit solution of the recurrence: for instance, we have mentioned in the introduction the need for such explicit solutions in the context of the normalization of phylogenetic balance indices. In a previous attempt to solve this problem, Hwang, Janson and Tsai [31] gave an explicit solution of Eq (1) when a = 1 and under very general conditions on the independent term, or toll function, p(n), in terms of sums of infinite series. But then, if one does not know how to sum the series, the explicit solution slips away.

In this paper we have restricted ourselves to the case when the toll function is a polynomial in ⌊n/2⌋ and ⌈n/2⌉. In this case, and for an arbitrary coefficient a, we are able to give a finite explicit expression for the solution of (1) in terms only of the binary expansion of n. The existence of such a closed formula is not surprising, but, for instance, it cannot be deduced directly from Hwang, Janson and Tsai solution. An implementation of our solution in Python is available at https://github.com/biocom-uib/divide_and_conquer.

The restriction to a polynomial independent term is a serious limitation for the usefulness of our formula. It remains as future work to use the same approach to obtain explicit solutions for other specific types of toll functions, including for instance terms affected by coefficients (−1)n/2⌋ and (−1)n/2⌉ (we have seen in Example 4 how our approach allows to deal with terms affected by coefficients (−1)n) or rational functions in ⌊n/2⌋ and ⌈n/2⌉. The main obstacle in the derivation of such formulas is the generalization to their setting of the key Lemma 5, used to simplify the sums γl(d,p,m) in Lemma 6. Also it would be interesting to obtain similar explicit solutions when the coefficients of xn/2⌋ and xn/2⌉ are different, and more specifically when one of them is 0. This is done for homogeneous equations in [45, Lem. 4], but the expression provided therein for the solution xn involves sums from 1 to n, and not up to ⌊log2(n)⌋ as those obtained with our techniques.

Supporting information

S1 File. Proofs of several results.

The file provides the detailed proofs of Lemmas 4–6 and Propositions 9 and 12.

(PDF)

Acknowledgments

We thank G. Valiente for some useful suggestions.

Data Availability

The relevant data are fully available in Github at https://github.com/biocom-uib/divide_and_conquer.

Funding Statement

All authors were partially funded by the Spanish Ministry of Science and Innovation and the European Regional Development Fund through projects PGC2018-096956-B-C43 and PID2021-126114NB-C44 (FEDER/MICINN/AEI). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

References

  • 1.R. Stephan. Some Divide and Conquer Sequences with (relatively) Simple Ordinary Generating Functions. OEIS (2014), https://oeis.org/somedcgf.html.
  • 2. Aho A. V., Hopcroft J. E., Ullman J. D. The design and analysis of computer algorithms. Addison-Wesley Publishing Company; (1974). [Google Scholar]
  • 3. Felsenstein J. Inferring Phylogenies. Sinauer Associates; (2004). [Google Scholar]
  • 4. Semple C. and Steel M. Phylogenetics. Oxford University Press; (2003). [Google Scholar]
  • 5. Futuyma D. J. (Ed. Chair). Executive document: Evolution, science and society: Evolutionary biology and the National Research Agenda. The American Naturalist 158 (2001), S4. [Google Scholar]
  • 6. Dehmer M., Emmert-Streib F. (Eds.). Quantitative graph theory. CRC Press; (2014). [Google Scholar]
  • 7. Colless D. Review of “Phylogenetics: the theory and practice of phylogenetic systematics”. Systematic Zoology 31 (1982), 100–104. doi: 10.2307/2413420 [DOI] [Google Scholar]
  • 8. Fisher M., Liebscher V. On the balance of unrooted trees. Journal of Graph Algorithms and Applications, 25 (2021), 133–150. doi: 10.7155/jgaa.00553 [DOI] [Google Scholar]
  • 9. Fusco G., Cronk Q. C. A new method for evaluating the shape of large phylogenies. Journal of Theoretical Biology 175 (1995), 235–243. doi: 10.1006/jtbi.1995.0136 [DOI] [Google Scholar]
  • 10. Kirkpatrick M., Slatkin M. Searching for evolutionary patterns in the shape of a phylogenetic tree. Evolution 47 (1993), 1171–1181. doi: 10.1111/j.1558-5646.1993.tb02144.x [DOI] [PubMed] [Google Scholar]
  • 11. McKenzie A., Steel M. Distributions of cherries for two models of trees. Mathematical Biosciences 164 (2000), 81–92. doi: 10.1016/S0025-5564(99)00060-7 [DOI] [PubMed] [Google Scholar]
  • 12. Mir A., Rosselló F., Rotger L. A new balance index for phylogenetic trees. Mathematical Biosciences, 241 (2013), 125–136. doi: 10.1016/j.mbs.2012.10.005 [DOI] [PubMed] [Google Scholar]
  • 13. Mir A., Rotger L., Rosselló F. Sound Colless-like balance indices for multifurcating trees. PLoS ONE 13 (2018), e0203401. doi: 10.1371/journal.pone.0203401 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14. Sackin M. J. “Good” and “bad” phenograms. Systematic Zoology 21 (1972), 225–226. doi: 10.2307/2412292 [DOI] [Google Scholar]
  • 15. Shao K., Sokal R. Tree balance. Systematic Zoology 39 (1990), 266–276. [Google Scholar]
  • 16.M. Fischer, L. Herbst, S. Kersting, L. Kühn, K. Wicke. Tree balance indices: a comprehensive survey. arXiv:2109.12281 (2021).
  • 17. Coronado T. M., Mir A., Rosselló F., Valiente G. A balance index for phylogenetic trees based on rooted quartets. Journal of Mathematical Biology 79 (2019), 1105–1148. doi: 10.1007/s00285-019-01377-w [DOI] [PubMed] [Google Scholar]
  • 18. Stam E. Does imbalance in phylogenies reflect only bias? Evolution 56 (2002), 1292–1295. doi: 10.1111/j.0014-3820.2002.tb01440.x [DOI] [PubMed] [Google Scholar]
  • 19. Bentley J. L., Haken D., Saxe J. B. A general method for solving divide-and-conquer recurrences. ACM SIGACT News 12 (1980), 36–44. doi: 10.1145/1008861.1008865 [DOI] [Google Scholar]
  • 20. Cormen T. H., Leiserson C. E., Rivest R. L., Stein C. Introduction to Algorithms (4th Edition). MIT Press; (2009). [Google Scholar]
  • 21. Akra M., Bazzi L. On the solution of linear recurrence equations. Computational Optimization and Applications 10 (1998), 195–210. doi: 10.1023/A:1018373005182 [DOI] [Google Scholar]
  • 22. Drmota M., Szpankowski W. A master theorem for discrete divide and conquer recurrences. Journal of the ACM 60 (2013), 1–49. doi: 10.1145/2487241.2487242 [DOI] [Google Scholar]
  • 23.M. Guedj. A Simple but Powerful Extension of the Master Theorem for Divide-and-Conquer Sequences. hal-03329411 (2021).
  • 24. Kao M. Multiple-size divide-and-conquer recurrences. ACM SIGACT News 28 (1997), 67–69 doi: 10.1145/261342.261350 [DOI] [Google Scholar]
  • 25. Roura S. Improved Master Theorems for Divide-and-Conquer Recurrences. Journal of the ACM 48 (2001), 170–205. doi: 10.1145/375827.375837 [DOI] [Google Scholar]
  • 26. Verma R. M. A general method and a master theorem for divide-and-conquer recurrences with applications. Journal of Algorithms 16 (1994), 67–79. doi: 10.1006/jagm.1994.1004 [DOI] [Google Scholar]
  • 27. Verma R. M. General techniques for analyzing recursive algorithms with applications. SIAM Journal on Computing, 26 (1997), 568–581. doi: 10.1137/S0097539792240583 [DOI] [Google Scholar]
  • 28. Wang X., Fu Q. A frame for general divide-and-conquer recurrences. Information Processing Letters 59 (1996), 45–51 doi: 10.1016/0020-0190(96)00076-2 [DOI] [Google Scholar]
  • 29. Graham R., Knuth D., Patashnik O. Concrete Mathematics (2nd edition). Addison-Wesley; (1994). [Google Scholar]
  • 30. Ellul K., Krawetz B., Shallit J., Wang M. W. Regular expressions: New results and open problems. Journal of Automata, Languages and Combinatorics 9 (2004), 233–256. [Google Scholar]
  • 31. Hwang H. K., Janson S., Tsai T. H. Exact and asymptotic solutions of a divide-and-conquer recurrence dividing at half: Theory and applications. ACM Transactions on Algorithms 13 (2017), Article 47. doi: 10.1145/3127585 [DOI] [Google Scholar]
  • 32.Bernoulli numbers. Encyclopedia of Mathematics, URL: http://encyclopediaofmath.org/index.php?title=Bernoulli_numbers&oldid=32791.
  • 33. Fischer M. Extremal values of the Sackin tree balance index. Annals of Combinatorics 25 (2021), 515–541. doi: 10.1007/s00026-021-00539-2 [DOI] [Google Scholar]
  • 34. Coronado T. M., Fischer M., Herbst L., Rosselló F., Wicke K. On the minimum value of the Colless index and the bifurcating trees that achieve it, Journal of Mathematical Biology 80 (2020), 1993–2054. doi: 10.1007/s00285-020-01488-9 [DOI] [PubMed] [Google Scholar]
  • 35. Takagi T. A simple example of continuous function without derivative. Tokyo Sugaku Butsurigakkwai Hokoku 1 (1901), F176–F177. [Google Scholar]
  • 36. Allaart P. C., Kawamura K. The Takagi function: a survey. Real Analysis Exchange 37 (2012), 1–54. doi: 10.14321/realanalexch.37.1.0001 [DOI] [Google Scholar]
  • 37.L. Monroe, V. Job. Computationally inequivalent summations and their parenthetic forms. arXiv:2005.05387 (2020).
  • 38. Walsh J. L. A closed set of normal orthogonal functions. American Journal of Mathematics, 45 (1923), 5–24. doi: 10.2307/2387224 [DOI] [Google Scholar]
  • 39. Fine N. J. On the Walsh functions. Transactions of the American Mathematical Society 65 (1949), 372–414. doi: 10.1090/S0002-9947-1949-0032833-2 [DOI] [Google Scholar]
  • 40. Hwang H. K. Asymptotic expansion for the Lebesgue constants of the Walsh system. Journal of Computational and Applied Mathematics 71 (1996), 237–243. doi: 10.1016/0377-0427(95)00236-7 [DOI] [Google Scholar]
  • 41.R. G. Stanton, W. L. Kocay, P. H. Dirksen. Computation of a combinatorial function. Proceedings 5th British Combinatorial Conference, Congressus Numerantium, Vol. 15 (1975), 569–578.
  • 42. Karamanos K. From symbolic dynamics to a digital approach. International Journal of Bifurcation and Chaos 11 (2001), 1683–1694. doi: 10.1142/S0218127401002924 [DOI] [Google Scholar]
  • 43. Thompson B.C. Solving recurrence relations involving floor and ceiling functions. Electronics Letters, 30 (1994), 1391–1393. doi: 10.1049/el:19940960 [DOI] [Google Scholar]
  • 44.M. Abramowitz, I. A. S. Stegun. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables (10th printing). National Bureau of Standards Applied Mathematics Series, 55 (1972).
  • 45. Chang K.-N., Tsai S.-C. Exact solution of a minimal recurrence. Information Processing Letters 75 (2000), 61–64. doi: 10.1016/S0020-0190(00)00076-4 [DOI] [Google Scholar]

Decision Letter 0

Ashwani Kumar

22 Jun 2022

PONE-D-22-15094Explicit solution of divide-and-conquer dividing by a half recurrences with polynomial independent termPLOS ONE

Dear Dr. Rosselló,

Thank you for submitting your manuscript to PLOS ONE. After careful consideration, we feel that it has merit but does not fully meet PLOS ONE’s publication criteria as it currently stands. Therefore, we invite you to submit a revised version of the manuscript that addresses the points raised during the review process.

Please submit your revised manuscript by Aug 06 2022 11:59PM. If you will need more time than this to complete your revisions, please reply to this message or contact the journal office at plosone@plos.org. When you're ready to submit your revision, log on to https://www.editorialmanager.com/pone/ and select the 'Submissions Needing Revision' folder to locate your manuscript file.

Please include the following items when submitting your revised manuscript:

  • A rebuttal letter that responds to each point raised by the academic editor and reviewer(s). You should upload this letter as a separate file labeled 'Response to Reviewers'.

  • A marked-up copy of your manuscript that highlights changes made to the original version. You should upload this as a separate file labeled 'Revised Manuscript with Track Changes'.

  • An unmarked version of your revised paper without tracked changes. You should upload this as a separate file labeled 'Manuscript'.

If you would like to make changes to your financial disclosure, please include your updated statement in your cover letter. Guidelines for resubmitting your figure files are available below the reviewer comments at the end of this letter.

If applicable, we recommend that you deposit your laboratory protocols in protocols.io to enhance the reproducibility of your results. Protocols.io assigns your protocol its own identifier (DOI) so that it can be cited independently in the future. For instructions see: https://journals.plos.org/plosone/s/submission-guidelines#loc-laboratory-protocols. Additionally, PLOS ONE offers an option for publishing peer-reviewed Lab Protocol articles, which describe protocols hosted on protocols.io. Read more information on sharing protocols at https://plos.org/protocols?utm_medium=editorial-email&utm_source=authorletters&utm_campaign=protocols.

We look forward to receiving your revised manuscript.

Kind regards,

Ashwani Kumar, Ph.D.

Academic Editor

PLOS ONE

Journal Requirements:

When submitting your revision, we need you to address these additional requirements.

1. Please ensure that your manuscript meets PLOS ONE's style requirements, including those for file naming. The PLOS ONE style templates can be found at 

https://journals.plos.org/plosone/s/file?id=wjVg/PLOSOne_formatting_sample_main_body.pdf and 

https://journals.plos.org/plosone/s/file?id=ba62/PLOSOne_formatting_sample_title_authors_affiliations.pdf

2. Thank you for stating the following in the Acknowledgments Section of your manuscript: 

"This research was partially supported by the Spanish Ministry of Science, Innovation and

Universities and the European Regional Development Fund through projects PGC2018-096956-B-C43 and PID2021-126114NB-C44 (FEDER/MICINN/AEI)."

We note that you have provided funding information that is not currently declared in your Funding Statement. However, funding information should not appear in the Acknowledgments section or other areas of your manuscript. We will only publish funding information present in the Funding Statement section of the online submission form. 

Please remove any funding-related text from the manuscript and let us know how you would like to update your Funding Statement. Currently, your Funding Statement reads as follows: 

"All authors were partially funded by the Spanish Ministry of Science and Innovation and the European Regional Development Fund through projects PGC2018-096956-B-C43 and PID2021-126114NB-C44 (FEDER/MICINN/AEI). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript."

Please include your amended statements within your cover letter; we will change the online submission form on your behalf.

3. Please review your reference list to ensure that it is complete and correct. If you have cited papers that have been retracted, please include the rationale for doing so in the manuscript text, or remove these references and replace them with relevant current references. Any changes to the reference list should be mentioned in the rebuttal letter that accompanies your revised manuscript. If you need to cite a retracted article, indicate the article’s retracted status in the References list and also include a citation and full reference for the retraction notice.

[Note: HTML markup is below. Please do not edit.]

Reviewers' comments:

Reviewer's Responses to Questions

Comments to the Author

1. Is the manuscript technically sound, and do the data support the conclusions?

The manuscript must describe a technically sound piece of scientific research with data that supports the conclusions. Experiments must have been conducted rigorously, with appropriate controls, replication, and sample sizes. The conclusions must be drawn appropriately based on the data presented.

Reviewer #1: Yes

Reviewer #2: Yes

**********

2. Has the statistical analysis been performed appropriately and rigorously?

Reviewer #1: N/A

Reviewer #2: Yes

**********

3. Have the authors made all data underlying the findings in their manuscript fully available?

The PLOS Data policy requires authors to make all data underlying the findings described in their manuscript fully available without restriction, with rare exception (please refer to the Data Availability Statement in the manuscript PDF file). The data should be provided as part of the manuscript or its supporting information, or deposited to a public repository. For example, in addition to summary statistics, the data points behind means, medians and variance measures should be available. If there are restrictions on publicly sharing data—e.g. participant privacy or use of data from a third party—those must be specified.

Reviewer #1: Yes

Reviewer #2: Yes

**********

4. Is the manuscript presented in an intelligible fashion and written in standard English?

PLOS ONE does not copyedit accepted manuscripts, so the language in submitted articles must be clear, correct, and unambiguous. Any typographical or grammatical errors should be corrected at revision, so please note any specific errors here.

Reviewer #1: Yes

Reviewer #2: Yes

**********

5. Review Comments to the Author

Please use the space provided to explain your answers to the questions above. You may also include additional comments for the author, including concerns about dual publication, research ethics, or publication ethics. (Please upload your review as an attachment if it exceeds 20,000 characters)

Reviewer #1: In this study, the authors explore the explicit solution of divide-and-conquer dividing by a half recurrences with polynomial independent term. The aim and objective of the study are clear to me and work is very interesting. The publication is recommended after addressing the following comments:

1. The abstract should contain answers to the following questions: What problem was ‎studied and why is it important? Add a few applications of the current elaborated problem, and avoid citation in the abstract. Don’t used equation in the abstract, remove it if feasible.

2. The motivation and gap of study is not really highlighted in the last paragraph of the introduction section. The paragraph should elaborate more on the importance, and address/highlight the research contributions.

3. The originality of the paper needs to be stated clearly. It is of important to have sufficient results to justify the novelty of a high-quality journal paper. The Introduction should make a compelling case for why the study is useful along with a clear statement of its novelty or originality by providing relevant information and providing answers to basic questions such as: What is already known in the open literature? What is missing (i.e., research gaps)? What needs to be done, why and how? Clear statements of the novelty of the work should also appear briefly in the Abstract and Conclusions sections.

4. Check all the equations for possible typo mistakes.

5. Must write real application of elaborated problem.

6. Write future direction of the current study.

Reviewer #2: The authors presented a mathematical analysis using divide-and-conquer dividing by a half recurrences. This methodology can be used in many areas of applied mathematics. The mathematical aspects of the paper are interesting; so, I recommend the paper for publication after some modifications.

1. What is new in the model equations and why these are considered?

2. Is it necessary to restrict yourselves to the case when the toll function is a polynomial?

3. When will explicit solution zero?

4. Correlate your work with the earlier ones and provide distinction of your work.

please address above issues in the revised paper.

**********

6. PLOS authors have the option to publish the peer review history of their article (what does this mean?). If published, this will include your full peer review and any attached files.

If you choose “no”, your identity will remain anonymous but your review may still be made public.

Do you want your identity to be public for this peer review? For information about this choice, including consent withdrawal, please see our Privacy Policy.

Reviewer #1: No

Reviewer #2: Yes: Sohail Ahmad

**********

[NOTE: If reviewer comments were submitted as an attachment file, they will be attached to this email and accessible via the submission site. Please log into your account, locate the manuscript record, and check for the action link "View Attachments". If this link does not appear, there are no attachment files.]

While revising your submission, please upload your figure files to the Preflight Analysis and Conversion Engine (PACE) digital diagnostic tool, https://pacev2.apexcovantage.com/. PACE helps ensure that figures meet PLOS requirements. To use PACE, you must first register as a user. Registration is free. Then, login and navigate to the UPLOAD tab, where you will find detailed instructions on how to use the tool. If you encounter any issues or have any questions when using PACE, please email PLOS at figures@plos.org. Please note that Supporting Information files do not need this step.

Decision Letter 1

Ashwani Kumar

30 Aug 2022

Explicit solution of divide-and-conquer dividing by a half recurrences with polynomial independent term

PONE-D-22-15094R1

Dear Dr. Rosselló,

We’re pleased to inform you that your manuscript has been judged scientifically suitable for publication and will be formally accepted for publication once it meets all outstanding technical requirements.

Within one week, you’ll receive an e-mail detailing the required amendments. When these have been addressed, you’ll receive a formal acceptance letter and your manuscript will be scheduled for publication.

An invoice for payment will follow shortly after the formal acceptance. To ensure an efficient process, please log into Editorial Manager at http://www.editorialmanager.com/pone/, click the 'Update My Information' link at the top of the page, and double check that your user information is up-to-date. If you have any billing related questions, please contact our Author Billing department directly at authorbilling@plos.org.

If your institution or institutions have a press office, please notify them about your upcoming paper to help maximize its impact. If they’ll be preparing press materials, please inform our press team as soon as possible -- no later than 48 hours after receiving the formal acceptance. Your manuscript will remain under strict press embargo until 2 pm Eastern Time on the date of publication. For more information, please contact onepress@plos.org.

Kind regards,

Ashwani Kumar, Ph.D.

Academic Editor

PLOS ONE

Additional Editor Comments (optional):

Reviewers' comments:

Reviewer's Responses to Questions

Comments to the Author

1. If the authors have adequately addressed your comments raised in a previous round of review and you feel that this manuscript is now acceptable for publication, you may indicate that here to bypass the “Comments to the Author” section, enter your conflict of interest statement in the “Confidential to Editor” section, and submit your "Accept" recommendation.

Reviewer #1: All comments have been addressed

Reviewer #2: All comments have been addressed

**********

2. Is the manuscript technically sound, and do the data support the conclusions?

The manuscript must describe a technically sound piece of scientific research with data that supports the conclusions. Experiments must have been conducted rigorously, with appropriate controls, replication, and sample sizes. The conclusions must be drawn appropriately based on the data presented.

Reviewer #1: Yes

Reviewer #2: Yes

**********

3. Has the statistical analysis been performed appropriately and rigorously?

Reviewer #1: N/A

Reviewer #2: Yes

**********

4. Have the authors made all data underlying the findings in their manuscript fully available?

The PLOS Data policy requires authors to make all data underlying the findings described in their manuscript fully available without restriction, with rare exception (please refer to the Data Availability Statement in the manuscript PDF file). The data should be provided as part of the manuscript or its supporting information, or deposited to a public repository. For example, in addition to summary statistics, the data points behind means, medians and variance measures should be available. If there are restrictions on publicly sharing data—e.g. participant privacy or use of data from a third party—those must be specified.

Reviewer #1: Yes

Reviewer #2: Yes

**********

5. Is the manuscript presented in an intelligible fashion and written in standard English?

PLOS ONE does not copyedit accepted manuscripts, so the language in submitted articles must be clear, correct, and unambiguous. Any typographical or grammatical errors should be corrected at revision, so please note any specific errors here.

Reviewer #1: Yes

Reviewer #2: Yes

**********

6. Review Comments to the Author

Please use the space provided to explain your answers to the questions above. You may also include additional comments for the author, including concerns about dual publication, research ethics, or publication ethics. (Please upload your review as an attachment if it exceeds 20,000 characters)

Reviewer #1: (No Response)

Reviewer #2: I appreciate the effort of authors. The manuscript has been well revised. I recommend the paper for publication.

**********

7. PLOS authors have the option to publish the peer review history of their article (what does this mean?). If published, this will include your full peer review and any attached files.

If you choose “no”, your identity will remain anonymous but your review may still be made public.

Do you want your identity to be public for this peer review? For information about this choice, including consent withdrawal, please see our Privacy Policy.

Reviewer #1: Yes: Bagh Ali

Reviewer #2: Yes: Sohail Ahmad

**********

Acceptance letter

Ashwani Kumar

2 Sep 2022

PONE-D-22-15094R1

Explicit solution of divide-and-conquer dividing by a half recurrences with polynomial independent term

Dear Dr. Rosselló:

I'm pleased to inform you that your manuscript has been deemed suitable for publication in PLOS ONE. Congratulations! Your manuscript is now with our production department.

If your institution or institutions have a press office, please let them know about your upcoming paper now to help maximize its impact. If they'll be preparing press materials, please inform our press team within the next 48 hours. Your manuscript will remain under strict press embargo until 2 pm Eastern Time on the date of publication. For more information please contact onepress@plos.org.

If we can help with anything else, please email us at plosone@plos.org.

Thank you for submitting your work to PLOS ONE and supporting open access.

Kind regards,

PLOS ONE Editorial Office Staff

on behalf of

Dr. Ashwani Kumar

Academic Editor

PLOS ONE

Associated Data

    This section collects any data citations, data availability statements, or supplementary materials included in this article.

    Supplementary Materials

    S1 File. Proofs of several results.

    The file provides the detailed proofs of Lemmas 4–6 and Propositions 9 and 12.

    (PDF)

    Attachment

    Submitted filename: responsetoreviewers.pdf

    Data Availability Statement

    The relevant data are fully available in Github at https://github.com/biocom-uib/divide_and_conquer.


    Articles from PLOS ONE are provided here courtesy of PLOS

    RESOURCES