Congruence Properties of the Function that Counts Compositions into Powers of 2

Giedrius Alkauskas^{1}

Institute of Mathematics, Department of Integrative Biology Universität für Bodenkultur Gregor Mendel-Straße 33 A-1180 Wien Austria

and

Vilnius University, Department of Mathematics and Informatics Naugarduko 24 LT-03225 Vilnius Lithuania

             giedrius.alkauskas@gmail.com

Abstract

Let ϑ(n) denote the number of compositions (ordered partitions) of a positive integer n into powers of 2. It appears that the function ϑ(n) satisfies many congruences modulo 2^{N}. For example, for every integer a there exists (as k tends to infinity) the limit of ϑ(2^{k} + a) in the 2−adic topology. The parity of ϑ(n) obeys a simple rule. In this paper we extend this result to higher powers of 2. In particular, we prove that for each positive integer N there exists a finite table which lists all the possible cases of this sequence modulo 2^{N}. One of our main results claims that ϑ(n) is divisible by 2^{N} for almost all n, however large the value of N is.

1The author gratefully acknowledges support from the Austrian Science Fund (FWF) under the project Nr. P20847-N18.

1 Introduction

Let ϑ(n) denote the number of compositions of a positive integer n into powers of 2 (compositions are sometimes called ordered partitions): this is the amount of finite sequences {q_{1}, q_{2}, …, q_{ℓ}} of non-negative integers such that n = 2^{q_{1}} +2^{q_{2}} +⋯+2^{q_{ℓ}}. Thus, for example, 3 = 1 + 1 + 1 = 2 + 1 = 1 + 2 give all possible compositions, hence ϑ(3) = 3. This sequence appears in Sloane’s encyclopedia [8] as \underline{A023359}. Several properties of this sequence are also listed there. Let us call this function the binary composition function. It is easy to see (with the help of calculus of residues) that

ϑ(n) ∼ \frac{c}{ρ^{n+1}} ,

where ρ is the unique zero of f(x) = 1 − ∑_{k=0}^{∞} x^{2^{k}} in the interval (0, 1), and c = −\frac{1}{f′(ρ)}. Nevertheless, in this note we are mainly concerned with 2−adic rather than with real asymptotics.

The binary partition function b(n) (which counts the partitions of n into non-negative powers of 2 neglecting the order of the summands) was investigated by many authors, beginning with L. Euler (1750), and in the 20th century A. Tanturi (1918), K. Mahler (1940) (who explored asymptotic behavior). See the sequences \underline{A018819} and \underline{A000123} in Sloane’s Encyclopedia [8]; one can find numerous references there. Congruence properties of b(n) modulo powers of 2 were first observed by R. F. Churchhouse [5] (the main congruence was given without a proof as a conjecture). This conjecture was later proved by H. Gupta [6] and independently by Ø. Rødseth [7]. This result can also be found in Andrews’ monograph [3]. The paper by the author [1] gives another proof of this fact along with one possible generalization of this congruence. As an aside [1], for every positive integer s which is not divisible by 8 there exists a finite algorithm to verify the fact that infinitely many terms of the sequence b(n) are divisible by s. Calculations confirmed this for 2 ≤ s ≤ 14, s ≠ 8 (as was noticed by Churchhouse himself, b(n) is never divisible by 8). Moreover, for every power of 2 there exists a finite table which lists all the possible remainders of b(n) modulo this power. For example, modulo 32 one of the entries is [1]

b(4n + 2) ≡ 2 + 4w(n) + 8w(⌊n/2⌋) + 16τ(n) (mod 32)).

Here ⌊⋆⌋ stands for the “floor” function, w(n) represents the Thue-Morse sequence with initial conditions w(0) = 0, w(1) = 1, and τ(n) stands for the Rudin-Shapiro sequence with conditions τ(0) = 0 and τ(3) = 1.

We will now formulate the Rødseth-Gupta theorem.

Theorem. If n is odd positive integer, then for any integer s ≥ 1 we have

b(2^{s+2}n) ≡ b(2^{s}n) (mod 2^{μ(s)}), were μ(s) = ⌊\frac{3s + 4}{2}⌋;

moreover, this congruence is exact.

On the other hand, the binary composition function has not yet been arithmetically investigated. The only papers (apart from The On-Line Encyclopedia of Integer Sequences) where this sequence appears are the papers by the author [2] and by Chinn and Niederhausen [4]. The authors of the latter are concerned with finding an exact formula for the number of binary compositions of n into exactly n − k parts for small k.

If we consider compositions of a positive integer n with no limitation on the non-negative summands, then the amount of these is equal to 2^{n−1}. On the other hand, compositions with summands coming from a certain set reveal new congruence phenomena. For example, one of our main results is the following surprising fact. Let us denote by s_{2}(n) the amount of 1’s in the binary expansion of n. This is the sequence \underline{A000120}.

Theorem 1. Suppose that n ≥ 1, N ≥ 1, and s_{2}(n + 2^{N−1}) ≥ 2^{N}. Then

ϑ(n) ≡ 0 (mod 2^{N}).

Let us say that a property A is satisfied for almost all natural numbers, if

lim_{M→∞} \frac{#\{n ≤ M : n satisfies property A\}}{M} = 1.

Corollary 2. Let N ∈ ℕ. Then for almost all natural numbers the congruence ϑ(n) ≡ 0 (mod 2^{N}) is satisfied.

Proof. This is clear: for a fixed M ∈ ℕ, almost all natural numbers will have more than M 1’s in the binary expansion.

2 Congruence properties

Now we will derive some basic facts about ϑ(n). Les us make a convention ϑ(0) = 1 and ϑ(−n) = 0 for n ∈ ℕ. Binary compositions of n can be divided into disjoined subsets, each of which consists of compositions with the first summand equal to 2^{k}, 1 ≤ 2^{k} ≤ n. Thus, this gives the recurrence relation, which also appears in [2, 4, 8]:

ϑ(n) = ∑_{k≥0} ϑ(n − 2^{k}).  (1)

Hence, the generating function is give by

∑_{n=0}^{∞} ϑ(n)x^{n} = (1 − ∑_{k=0}^{∞} x^{2^{k}})^{−1}.

From the recurrence relation we can already determine the parity of ϑ(n). This is the only property which admits easy proof directly from (1).

Proposition 3. The number ϑ(n) is odd if and only if n = 2^{u} − 1, u ≥ 0.

Proof. Suppose we have already proved this statement for all positive integers ≤ n−1. From the recurrence relation and inductive hypothesis we inherit that the parity of ϑ(n) equals the parity of the amount of odd terms among ϑ(n−2^{u}), u ≥ 0. This term is odd iff (according to the induction hypothesis) n − 2^{u} = 2^{v} − 1; that is, it happens only iff n + 1 = 2^{u} + 2^{v}. Hence, if s_{2}(n+1) > 2, this cannot occur. If s_{2}(n+1) = 2, so n+1 = 2^{u} +2^{v}, u ≠ v, we have exactly two odd summands: ϑ(n − 2^{u}) and ϑ(n − 2^{v}), and therefore the sum is even. Finally, we have only one odd summand iff n = 2^{u} − 1, and this summand is ϑ(n − 2^{u−1}) = ϑ(2^{u−1} − 1). We finish by induction.

The congruence properties of the binary composition function modulo higher powers of 2 were observed by the author [2]. One of these congruences claim that

ϑ(2^{k}) ≡ 8 (mod 16) for k ≥ 3.  (2)

Unfortunately, despite many efforts to manipulate with (1), this and similar claims were not proved in [2] but rather extrapolated from numerical data. This failure suggests the fact that the recurrence (1) alone is insufficient in proving these congruences. Luckily, one can derive some other recurrence relations, much more convenient and powerful.

Proposition 4. For n ≥ 1, we have

ϑ(2n) = ϑ^{2}(n) + ∑_{{a+b=2n−2^{s} \atop a,b<n,s≥1}} ϑ(a) · ϑ(b).  (3)

In general, for m, n ≥ 1, the following equality holds

ϑ(m + n) = ϑ(m) · ϑ(n) + ∑_{{a+b=m+n−2^{s} \atop a<m,b<n,s≥1}} ϑ(a) · ϑ(b).  (4)

Thus, in case m = n this gives (3), and in case m = 1 this reduces exactly to (1).

Proof. As a matter of fact, this identity is valid for any function which counts compositions of n into positive integers 1 = a_{1} < a_{2} < a_{3} < ⋯, only 2^{s} must be replaced with a_{s} in the formula. To prove the identity, consider any composition of m + n:

m + n = 2^{q_{1}} + 2^{q_{2}} + ⋯ + 2^{q_{ℓ}}.

Let s be the largest non-negative integer such that ∑_{i=1}^{s} 2^{q_{i}} ≤ m (if s = 0, the empty sum is 0 by convention). The number of compositions of m + n where ∑_{i=1}^{s} 2^{q_{i}} = m for some s is obviously equal to ϑ(m) · ϑ(n). If a = ∑_{i=1}^{s} 2^{q_{i}} < m, then b = ∑_{i=s+2}^{ℓ} 2^{q_{i}} < n. Thus, m + n − a − b = 2^{q_{s+1}}. Thus, if a < m and b < n are fixed, the amount of such compositions is equal to ϑ(a) · ϑ(b). This proves the formula (4).

Now we are able to derive the following Proposition 5. The sequence ϑ(n) can be completely described modulo 4.

(i) For n ≥ 3, let τ_{3}(n) denote the number of solutions of n + 1 = 2^{s} + 2^{v} + 2^{u} with s ≥ v > u ≥ 0, let τ_{2}(n) denote the number of solutions of n + 1 = 2^{s} + 2^{u}, and let τ_{1}(n) denote the number of solutions of n + 1 = 2^{s}. Then

ϑ(2n) ≡ 2τ_{3}(n) + τ_{2}(n) + τ_{1}(n) (mod 4).

(ii) In a similar way, ϑ(2^{k} − 1) ≡ 3 (mod 4) for k ≥ 2, and ϑ(2^{k} + 2^{l} − 1) ≡ 2 (mod 4) for k > l ≥ 1. In all other cases, ϑ(2n − 1) ≡ 0 (mod 4) (the first occurrence is n = 7).

Proof. (i) Note that (3) can be rewritten as

ϑ(2n) = ϑ^{2}(n) + 2 ∑_{{a+b=2n−2^{s} \atop 0≤a<b<n,s≥1}} ϑ(a) · ϑ(b) + ∑_{s≥1} ϑ^{2}(n − 2^{s−1}).  (5)

Consider this equality modulo 4. Obviously, ϑ^{2}(n) ≡ τ_{1}(n) (mod 4), since this is implied by Proposition 3. In the second sum, only the terms with a = 2^{u} − 1 and b = 2^{v} − 1, u, v ≥ 0, do contribute to the final result. In this case 2n = 2^{s} + 2^{u} − 1 + 2^{v} − 1. Thus, suppose n is of this form. Since a < b, we have u < v, u ≥ 1, and also, since 2^{v} − 1 < n, it is easy to see that s ≥ v. The number of solutions is thus τ_{2}(n). Finally, the second sum contributes exactly τ_{2}(n).

(ii) Equally, (4) for m = n − 1 reads as

ϑ(2n − 1) = ϑ(n − 1) · ϑ(n) + ∑_{{a+b=2n−1−2^{s} \atop a<n−1,b<n,s≥1}} ϑ(a) · ϑ(b)

= ϑ(n − 1) · ϑ(n) + ∑_{s≥1} ϑ(n − 2^{s}) · ϑ(n − 1) + 2 ∑_{{a+b=2n−1−2^{s} \atop a<b<n−1,s≥1}} ϑ(a) · ϑ(b)

= 2ϑ(n − 1) · ϑ(n) − ϑ^{2}(n − 1) + 2 ∑_{{a+b=2n−1−2^{s} \atop a<b<n−1,s≥1}} ϑ(a) · ϑ(b).  (6)

Here we used (1). In the sum, we have zero contribution to ϑ(2n − 1) modulo 4 unless a = 2^{u} − 1, b = 2^{v} − 1, and 2^{u} − 1 + 2^{v} − 1 = 2n − 1 − 2^{s}. Thus, u = 0 and n = 2^{s−1} + 2^{v−1}. Since b = 2^{v} − 1 < n − 1, this implies s > v. Thus, there exists at most one such solution, and this happens exactly when s_{2}(n) = 2. If n = 2^{k}, k ≥ 1, we get that ϑ(2^{k+1} − 1) ≡ −ϑ^{2}(2^{k} − 1) ≡ 34).

The following table summarizes the results of Proposition 5.

1. Sequence ϑ(n) modulo 4, n ≥ 2

n ϑ(n) (mod 4) Condition
2^{k} + 2^{l} + 2^{m} − 2  2 k > l > m ≥ 1
2^{k} − 2  2  k ≥ 2
3 · 2^{k} − 2  2  k ≥ 1

Other even numbers 0

2^{k} − 1  3  k ≥ 2
2^{k} + 2^{l} − 1  2  k > l ≥ 1

Other odd numbers 0

This table should list all even numbers n such that s_{2}(n + 2) ≤ 3. However, two types of these numbers, namely {2^{k}, k ≥ 3} and {2^{k}+2^{l}−2, k > l+1 ≥ 3}, fall under the qualification “other even numbers”, while the type {n = 2^{k} + 2^{l}, k > l ≥ 2} is a special case of the first type listed in the table.

Let us now inspect the recurrences (5) and (6) more carefully. We will use the following well-known implication which, as a matter of fact, makes the investigations of quadratic forms over 2−adic number field rather exceptional in p−adic analysis. Let U, V ∈ ℤ, N ≥ 1. Then

if U ≡ V (mod 2^{N}) ⇒ U^{2} ≡ V^{2} (mod 2^{N+1}).

Suppose we know the sequence ϑ(n) modulo 2^{N}. In this case the recurrences (5), (6) and the above fact show us that the sequence ϑ(n) is completely describable modulo 2^{N+1} as well. Further, note that Table 1 lists only those even and odd numbers n such that s_{2}(n + 2) ≤ 3. The recurrence (5) shows then that the corresponding table for ϑ(n) modulo 8 will list only those even numbers n such that s_{2}(n + 4) ≤ 7. Exactly the same conclusion follows for odd n. Here is one tricky point. In fact, consider odd number 2n − 1 and the multiplier ϑ(n) of the term 2ϑ(n − 1)ϑ(n) in (6). This multiplier matters if s_{2}(n + 2) ≤ 3. This shows that odd numbers 2n − 1 such that s_{2}((2n − 1) + 5) ≤ 3 should also be considered as candidates to be listed in the table for ϑ(n) modulo 8. Indeed, it can happen that s_{2}((2n − 1) + 5) ≤ 3 and s_{2}((2n − 1) + 4) ≥ 8 are simultaneously satisfied. But then elementary considerations show that s_{2}(n + 1) ≥ 7. Thus, ϑ(n − 1) ≡ 0 (mod 4) and, due to this multiplier, the term 2ϑ(n − 1)ϑ(n) does not contribute to ϑ(2n − 1) (mod 8). We can proceed by induction on N. Therefore, a careful analysis of (5) and (6) implies the following

Theorem 6. For each positive integer N there exists a finite table (analogous to the Table 1) which lists a finite number of possibilities for ϑ(n) modulo 2^{N}. The table encompasses only finite number of classes of those positive integers n such that

s_{2}(n + 2^{N−1}) < 2^{N}.  (7)

If the entry n = 2^{k_{1}} +2^{k_{2}} +⋯+2^{k_{ℓ}} −2^{N−1} is in this table, the corresponding residue depends solely on ℓ and the exact shape of the collection of inequalities or equalities (the amount of these collections is also finite) satisfied by k_{1}, k_{2}, …, k_{ℓ}. These inequalities or equalities are of the form k_{i} = k_{i+1} + d_{i}, or k_{i} ≥ k_{i+1} + d_{i}, for a fixed collection of d_{i} ∈ ℕ. For those positive integers n which are not in this table, ϑ(n) ≡ 0 (mod 2^{N}).

This result has numerous corollaries. One immediate corollary is Theorem 1. Also, Theorem 6 says that to prove the congruence (2) or even to improve it to

ϑ(2^{k}) ≡ 8 (mod 32) for k ≥ 8

(which does hold), one needs to perform only a finite number of calculations: all what is demanded is to check that this congruence holds for k up to a given bound, to be rest assured that this holds throughout. Indeed, according to the Theorem 6, two numbers 2^{k+1} and 2^{k} will eventually qualify for the same entry in the table for k large enough (or be both left out of the table). For the very same reason, this allows to make the following claim. Let a ∈ ℤ. Then there exists

lim_{k→∞} ϑ(2^{k} + a) = Θ(a) ∈ ℤ_{2};

here ℤ_{2} stands for the ring of 2−adic integers, and the limit is taken in 2−adic topology. A generalization of this is the following

Corollary 7. Let P (x) = ∑_{i=0}^{d} a_{i}x^{i} be a polynomial with non-negative integral coefficients. Then for every integer N ∈ ℕ there exists k_{0} ∈ ℕ such that

ϑ(P (2^{k+1})) ≡ ϑ(P (2^{k})) (mod 2^{N}) for k ≥ k_{0}.

According to Theorem 1, if a polynomial P (x) = ∑_{i=0}^{d} a_{i}x^{i}, a_{d} ≥ 1, has at least one negative coefficient a_{i} < 0 with i ≥ 1, then ϑ(P (2^{k})) → 0 in 2−adic topology.

We finish with providing the table for ϑ(n) modulo 8.

2. Sequence ϑ(n) modulo 8, n ≥ 7

n ϑ(n) (mod 8) Condition
2^{k} + 2^{l} + 2^{m} − 2  6 k > l > m ≥ 1
2^{k} − 2  2  k ≥ 2
3 · 2^{k} − 2  6  k ≥ 1

Other even numbers 0

2^{k} − 1  7  k ≥ 3
2^{k} + 1  6  k ≥ 4
2^{k} + 2^{l} − 1  2  k > l ≥ 2
2^{k} − 3  4  k ≥ 4
3 · 2^{k} − 3  4  k ≥ 3
2^{k} + 2^{l} + 2^{m} − 3  4 k > l > m ≥ 2

Other odd numbers 0

Thus, for example, 4|ϑ(2n) ⇒ 8|ϑ(2n). The complete table for 2^{N} = 16 has the following entries, which are not members of larger classes:

ϑ(7 · 2^{k} − 2) ≡ 14 (mod 16) for k ≥ 1, ϑ(5 · 2^{k} − 2) ≡ 8 (mod 16) for k ≥ 3.

One could wonder, for example, whether these have combinatoric proofs.

Concerning the condition (7), it is certainly not sharp for N > 2, as the above table for 2^{N} = 8 suggests. Employing this table, we can show that in fact 2^{N} on the right hand side can be replaced by 2^{N−1} + 2^{N−3} − 1 for N ≥ 4. This might be also far from the optimal for larger N.

3. Sequence ϑ(n)

n  ϑ(n) mod 64 n  ϑ(n) mod 64 n  ϑ(n) mod 64
1  1 000001 25  882468 100100 49  751322695068 011100
2  2 000010 26  1558798 001110 50  1327134992166 100110
3  3 000011 27  2753448 101000 51  2344248747712 000000
4  6 000110 28  4863696 010000 52  4140876568224 100000
5  10 001010 29  8591212 101100 53  7314436562436 000100
6  18 010010 30  15175514 011010 54  12920206953182 011110
7  31 011111 31  26805983 011111 55  22822229201360 010000
8  56 111000 32  47350056 101000 56  40313142631496 001000
9  98 100010 33  83639030 110110 57  71209059135432 001000
10  174 101110 34  147739848 001000 58  125783547796216 111000
11  306 110010 35  260967362 000010 59  222183821668104 001000
12  542 011110 36  460972286 111110 60  392465083678728 001000
13  956 111100 37  814260544 000000 61  693249583836156 111100
14 1690 011010 38 1438308328 101000 62 1224554757801706 101010
15 2983 100111 39 2540625074 110010 63 2163051215343439 001111
16 5272 011000 40 4487755390 111110 64 3820809588459176 101000
17 9310 011110 41 7927162604 101100 65 6749070853108302 001110
18 16448 000000 42 14002525142 010110 66 11921546029897416 001000
19 29050 111010 43 24734033936 010000 67 21058196429732338 110010
20 51318 110110 44 43690150992 010000 68 37197158469308174 001110
21 90644 010100 45 77174200244 110100 69 65704990586807960 011000
22 160118 110110 46 136320361910 110110 70 116061171489076784 110000
23 282826 001010 47 240796030130 110010 71 205010234490786986 101010
24 499590 000110 48 425341653750 110110 72 362129691668018062 001110

References

[1] G. Alkauskas, A generalization of the Rødseth-Gupta theorem on binary partitions, Lithuanian Math. J. 43 (2003), 103–110.

[2] G. Alkauskas, Ordered binary partitions, unpublished manuscript (1998).

[3] G. E. Andrews, The Theory of Partitions, Cambridge University Press, 1998.

[4] Ph. Chinn and H. Niederhausen, Compositions into powers of 2, Proceedings of the Thirty-Fifth Southeastern International Conference on Combinatorics, Graph Theory and Computing, Congr. Numer. 168 (2004), 215–220.

[5] R. F. Churchhouse, Congruence properties of the binary partition function, Proc. Cambridge Philos. Soc. 66 (1969), 371–376.

[6] H. Gupta, Proof of the Churchhouse conjecture concerning binary partitions, Proc. Cambridge Philos. Soc. 70 (1971), 53–56.

[7] Ø. Rødseth, Some arithmetical properties of m-ary partitions, Proc. Cambridge Philos. Soc. 68 (1970), 447–453.

[8] N. J. A. Sloane, (2010), The On-Line Encyclopedia of Integer Sequences, published

electronically at: http://www.research.att.com/^{∼}njas/sequences/

2010 Mathematics Subject Classification: Primary 11P83; Secondary 11P81, 05A17 Keywords: Binary compositions, ordered partitions, congruence properties, 2-adic analysis

(Concerned with sequences \underline{A000120}, \underline{A000123}, \underline{A018819}, and \underline{A023359}.)

Received March 4 2010; revised version received April 29 2010. Published in Journal of Integer Sequences, May 3 2010.

Return to Journal of Integer Sequences home page.