ARITHMETIC ON BLOCKS

Abigail Hoit

Department of Mathematics, Elmhurst College, Elmhurst, IL 60126

                          abigailh@elmhurst.edu

Received: 11/29/02, Revised: 1/5/04, Accepted: 1/21/04, Published: 1/22/04

Abstract

We introduce a binary operation on strings (blocks) of elements from the set {0, 1, …, m − 1} where m is an arbitrary integer greater than 1. This operation is an extension of one introduced by Konrad Jacobs and Michael Keane in the 1960’s for blocks of 0’s and 1’s. We show that the extended operation is associative, introduce the concept of similar, cyclic, and circular blocks and provide a unique factorization theorem under this operation up to the similarity of the factors. We also give the conditions for commutativity of indecomposable blocks.

1. Introduction

In the late 1960’s, Konrad Jacobs and Michael Keane introduced an associative binary operation on strings (blocks) of 0’s and 1’s [Ja, Ke]. This operation, defined in Section 2 below, produces a new block of 0’s and 1’s with length equal to the product of the lengths of the original blocks. Jacobs and Keane used this operation to define block product sequences for use in their work on ergodic theory. These sequences also happen to be equivalent to binary Q-additive functions [Ho, Chapter 3].

We extend the Jacobs – Keane operation to blocks of elements from the set {0, 1, …, m − 1} where m is an arbitrary integer greater than 1. We then show that the associativity of the operation is preserved (Theorem 1 in Section 3). In Section 4, we introduce the definition of indecomposable, similar, and cyclic blocks and then give a unique factorization theorem into non-cyclic indecomposable blocks up to the similarity of the blocks. In Section 5, we state the definition of a circular block and give the conditions for commutativity of indecomposable blocks as Theorem 3.

For readers who are familiar with the subject of combinatorics on words, we note that the subject of block products bears some similarity to it. The basic associative operation used in the former subject is not the block product operation described here, but that of simple concatenation of strings (words). For a thorough introduction to the subject of combinatorics on words, see [Lo].

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #A01 2

2. Block Products

Define a 2-block to be a non-empty string of 0’s and 1’s. We write A′ to denote the block that has the same length as A, but with the 0’s and 1’s swapped. For example, if A = 00101, then A′ = 11010. The operator ×, introduced by Konrad Jacobs and Michael Keane in the 1960’s [Ja, Ke] is defined as follows.

Let A be a 2-block. Then we define

A × 0 = A and A × 1 = A′.

If B = b_{0}b_{1} ⋯ b_{k} is also a 2-block, then we define

A × B = (A × b_{0}) · (A × b_{1}) · · · · · (A × b_{k}) ,

where the · symbol denotes the concatenation of the blocks.

The following examples illustrate the operation ×.

00101 × 001 = (00101 × 0) · (00101 × 0) · (00101 × 1)

= 00101 · 00101 · 11010 = 001010010111010

001 × 00101 = (001 × 0) · (001 × 0) · (001 × 1) · (001 × 0) · (001 × 1)

= 001 · 001 · 110 · 001 · 110 = 001001110001110.

Now, let m be an integer greater than 1. An m-block is a non-empty string of elements from the set {0, 1, …, m − 1}. We define the (extended) operator × as follows.

Let A = a_{0}a_{1} ⋯ a_{j} be an m-block and b be an integer, 0 ≤ b < m. Then

A × b = a_{0} ⊕ b a_{1} ⊕ b ⋯ a_{j} ⊕ b,

where ⊕ denotes addition modulo m. If B = b_{0}b_{1} ⋯ b_{k} is also a 2-block, then the block product A × B is defined as before, that is,

A × B = (A × b_{0}) · (A × b_{1}) · · · · · (A × b_{k}) .

The following example illustrates this operation for m = 6.

2450 × 23 = (2450 × 2) · (2450 × 3)

= 4012 · 5123 = 40125123 Notation. Throughout this paper, m is assumed to be an integer greater than 1. All blocks are m-blocks. The operator × is the block product operator associated with m and addition modulo m is denoted by the operator ⊕. The operator · denotes concatenation. If A is a particular m-block, its length is written as |A| and for 0 ≤ i < |A|, A [i] is the (i + 1)^{th} element of A. For example, if A = 2468, then A [0] = 2, A [1] = 4, and so on.

It follows immediately from the definition of the block product A × B that

|A × B| = |A||B|  (1)

and that, for 0 ≤ n < |A||B|,

(A × B) [n] = A [r_{0}] ⊕ B [r_{1}] ,  (2)

where r_{0} and r_{1} are the unique integers (guaranteed by the division algorithm) for which

n = r_{0} + r_{1}|A|, 0 ≤ r_{0} < |A|, 0 ≤ r_{1} < |B| .

3. Associativity

We show in Theorem 1 below that × is associative. We first state the following extension of the division algorithm, which can be easily proved from the division algorithm by mathematical induction.

Lemma 1 Let a_{0}, a_{1}, …, a_{k} be integers greater than 1. For each integer n in the range 0 ≤ n < a_{0}a_{1} ⋯ a_{k}, there exist unique integers r_{0}, r_{1}, …, r_{k} such that

n = r_{0} + r_{1}a_{0} + r_{2}a_{0}a_{1} + ⋯ + r_{k}a_{0}a_{1} ⋯ a_{k−1}, 0 ≤ r_{i} < a_{i} (i = 0, 1, …, k).

Theorem 1 The operator × is associative.

Proof. Let A, B, and C be blocks. We need to show that (A × B) × C = A × (B × C). We first note that by (1),

|(A × B) × C| = |A| |B| |C| = |A × (B × C)| .

Let n be an integer with 0 ≤ n < |A| |B| |C| . By Lemma 1, there are unique nonnegative integers r, s, and t, such that

n = r + s |A| + t |A| |B| , 0 ≤ r < |A| , 0 ≤ s < |B| , 0 ≤ t < |C| .

By repeated applications of (2), we have

((A × B) × C) [n] = A [r] ⊕ B [s] ⊕ C [t] = (A × (B × C)) [n] ,

which completes the proof.

We note that the associativity of × gives the set of m-blocks a monoid structure with (right and left-hand) identity element given by the singleton block 0. There is not a group structure, however, because no inverse exists for any block of length greater than 1.

4. Unique Factorization

Because of the associativity of ×, we may write any finite block product A_{0}×A_{1}×⋯×A_{k} without ambiguity. If, for a given block B, there exist blocks A_{0}, A_{1}, …, A_{k} so that B = A_{0} × A_{1} × ⋯ × A_{k}, we call this a factorization of B. We say that a block B is called indecomposable if B = A × C implies |A| = 1 or |C| = 1. Theorem 2 below gives the conditions for unique factorization of blocks into indecomposable blocks of a certain type. We will need the following definitions and lemmas for the proof of this theorem.

Definitions.

(a) The block B is called cyclic of difference d if B [k + 1] − B [k] ≡ d (mod m) for 0 ≤ k < |B| − 1.

(b) The blocks A and B are called similar if |A| = |B| and A [k] − B [k] is constant modulo m for 0 ≤ k < |A| . We note that this is clearly an equivalence relation and write A ≅ B to mean that A and B are similar.

(b′) An equivalent definition for A ≅ B is that A = B ×c for some integer c, 0 ≤ c < m.

The following lemma gives us left and right cancellation for the × operator.

Lemma 2 Let A, B, C, and D be blocks such that A × C ≅ B × D. Then A ≅ B if and only if C ≅ D.

Proof. By the definition of similar blocks, |A × C| = |B × D| . Thus, by (1), we have

|A| |C| = |B| |D| .  (3)

Also, by the definition of similar blocks, there is some positive integer s such that

(A × C) [k] − (B × D) [k] ≡ s (mod m) , 0 ≤ k < |A| |C| .  (4)

Suppose first that A ≅ B. Then |A| = |B| , (and hence by (3), we have |C| = |D|), and there exists a positive integer t such that

A [k] − B [k] ≡ t (mod m) , 0 ≤ k < |A|.  (5)

Let n be an integer such that 0 ≤ n < |A| |C| . By the division algorithm, there exist unique positive integers q and r such that 0 ≤ r < |A| , 0 ≤ q < |C| and n = q |A| + r. So, by (2) and (5), we have

(A × C) [n] = A [r] ⊕ C [q] = B [r] ⊕ t ⊕ C [q] .  (6)

On the other hand, since |A| = |B| and |C| = |D| , it also follows from (2) that

(B × D) [n] = B [r] ⊕ D [q] .  (7)

By (6) and (7) we obtain

(A × C) [n] − (B × D) [n] ≡ t + C [q] − D [q] (mod m) .  (8)

By (4) and (8) it follows that C [q] − D [q] ≡ s − t (mod m) . Since q varies from 0 to |C| − 1 as n varies from 0 to |A| |C| − 1, we have C ≅ D.

Now suppose that C ≅ D. As before, by the definition of similarity, we have |A| = |B| and |C| = |D| , and we have a positive integer u such that

C [k] − D [k] ≡ u (mod m) , 0 ≤ k < |C|.  (9)

If we let n, r, and q be as above, then (7) is still true, and we have, by (2) and (9),

(A × C) [n] = A [r] ⊕ C [q] = A [r] ⊕ u ⊕ D [q] .  (10)

By (4), (7), (9), and (10), it follows that A [r] − B [r] ≡ s − u (mod m) . Since r varies from 0 to |A| − 1 as n varies from 0 to |A| |C| − 1, we have A ≅ B.

The next lemma provides unique factorization into 2 indecomposable blocks with the uniqueness up to blocks that are either similar or cyclic of the same difference. The following notation will be used throughout the proof. The block of the first k elements in a block A will be denoted by A [0 : k − 1] .

Lemma 3 Let A and B be indecomposable blocks of length greater than 1. Suppose that A × C ≅ B × D for some blocks C and D. Then either A ≅ B and C ≅ D or A and B are both cyclic of the same difference.

Proof. We first note that since A × C ≅ B × D, statements (3) and (4) from the proof of Lemma 2 still hold and for all integers k, with 0 < k ≤ |A| |C| , we have

(A × C) [0 : k − 1] ≅ (B × D) [0 : k − 1] .  (11)

We may assume without loss of generality that |A| ≤ |B| . We will distinguish three cases: |A| = |B| , |A| < |B| where |A| divides |B|, and |A| < |B| where |A| does not divide |B| . We will show the second case to be impossible.

Suppose first that |A| = |B| . We observe that (A × C) [0 : |A| − 1] = A × C [0] ≅ A and (B × D) [0 : |A| − 1] = (B × D) [0 : |B| − 1] = B × D [0] ≅ B. Thus, it follows from (11) that A ≅ B, and hence, from Lemma 2, that C ≅ D.

Now, suppose that |A| < |B| and |A| divides |B| , i.e., |B| = n |A| for some integer n ≥ 2. Then, by the definition of the block product,

(A × C) [0 : |B| − 1] = (A × C [0]) · (A × C [1]) · · · · · (A × C [n − 1])
= A × C [0 : n − 1] .  (12)

On the other hand,

(B × D) [0 : |B| − 1] = B × D [0] ≅ B.  (13)

It follows from (11), (12), and (13), that B ≅ A × C [0 : n − 1] . This contradicts the indecomposability of B. Therefore, it is not possible to have |A| < |B| such that |A| divides |B| .

It remains to consider the situation where |A| < |B| and |A| does not divide |B| . We will show that in this case, A and B are both cyclic of the same difference. Let q and r be the unique nonnegative integers guaranteed by the division algorithm such that

|B| = q |A| + r, 0 < r < |A| .

Then

(A × C) [0 : |B| − 1] = (A × C [0]) · (A × C [1]) ⋯
· (A × C [q − 1]) · (A [0 : r − 1] × C [q]) .  (14)

On the other hand, (13) still holds. Thus, by (11), (13), and (14), we have

B ≅ (A × C [0]) · (A × C [1]) · · · · · (A × C [q − 1]) · (A [0 : r − 1] × C [q]) . (15)

Now, the block of the second |B| elements of B×D is the block B×D [1] , and is therefore also similar to B. It follows from (4) that the block of the second |B| elements of A × C is also similar to B. On the other hand, if we let S be the block at the end of the block A, such that A = A [0 : r − 1] · S, then the block of the second |B| elements of A × C is either given by

(S × C [q]) · (A × C [q + 1]) · (A × C [q + 2]) · · · · · (A × C [2q − 1]) · (A [0 : 2r − 1] × C [2q]) ,

if 2r ≤ |A| , or

(S × C [q])·(A × C [q + 1])·(A × C [q + 2])· · · · ·(A × C [2q])·(A [0 : 2r − |A| − 1] × C [2q + 1]) ,

if 2r > |A| . In either case, we have

B ≅ S · α_{1} · α_{2} · · · · · α_{n} · T,  (16)

where n = q − 1 or q, each of the α_{i} is similar to A, and T ≅ A [0 : 2r − 1] or T ≅ A [0 : 2r − |A| − 1] . Thus from (15) and (16), we have

(A × C [0]) · (A × C [1]) · · · · · (A × C [q − 1]) · (A^{r} × C [q]) ≅ S · α_{1} · α_{2} · · · · · α_{n} · T. (17)

By comparing the two sides of (17), and noting that each α_{i} and each A × C(h) is similar to A, we see that A begins with a block that is similar to S and that each successive block of length |S| in A is similar to S as well. It follows that for any integers j and k, with 1 ≤ j ≤ |A| − 1 and j + k |S| ≢ 0 (mod |A|), we have

A [(j + k |S|) mod |A|] − A [(j − 1 + k |S|)mod |A|] ≡ A [j] − A [j − 1] (mod m) . (18)

We now show that this equivalence implies that A is cyclic.

Let g = gcd (|A| , |B|) . Suppose, for the sake of contradiction, that g > 1. If we allow j to range from 1 through g − 1 and k to range from 0 through \frac{|A|}{g} − 1 in (18), we see that the blocks of length g that lie inside A beginning at positions \{ 0 mod |A| , |S| mod |A| , 2 |S| mod |A| , …, (\frac{|A|}{g} − 1) |S| mod |A| \} are similar to A [0 : g − 1] . However, by the definition of S, we have |B| = (q + 1) |A| − |S| . Thus, these positions are exactly \{0, g, 2g, …, |A| − g\} , and so A = γ_{1} · γ_{2} · · · · · γ_{\frac{|A|}{g}} , where each of the γ_{i} is similar to A [0 : g − 1] . That is, A is the product of A [0 : g − 1] with

some other block of length \frac{|A|}{g}. This contradicts the indecomposability of A. Thus,

g = 1.

By the definition of S and g, we have gcd(|S| , |A|) = 1 also. Therefore, for each j, 2 ≤ j ≤ |A| , there is some integer k such that (j + k |S|) mod |A| = j − 1, and so, by (18), we have

A [j − 1] − A [j − 2] ≡ A [j] − A [j − 1] (mod m) , 2 ≤ j ≤ |A| .

Thus, A is cyclic. It remains only to show that B is cyclic and of the same difference as A. Let h be an integer with 2 ≤ h ≤ |B| . Consider the two-element blocks in B given by B [h − 1] B [h] and B [h − 2] B [h − 1]. By (15) and (16), each of these two-element blocks is similar to a block that lies entirely in A. Since A is cyclic, the differences between the two elements in these blocks must be the same. Since h was arbitrary, we have

B [h − 1] − B [h − 2] ≡ B [h] − B [h − 1] ≡ A [1] − A [0] (mod m) , 2 ≤ h ≤ |B| .

Thus, B is cyclic of the same difference as A.

Theorem 2 (Unique Factorization) Let k ≥ 1, and let A_{1}, A_{2}, …, A_{k} be indecomposable, non-cyclic blocks of length greater than 1. If A_{1}×A_{2}×⋯×A_{k} = B_{1}×B_{2}×⋯×B_{l}, with B_{j} indecomposable, non-cyclic and of length greater than 1 for all j, then l = k and B_{j} ≅ A_{j} for all j, 1 ≤ j ≤ l.

Proof. We note that in Lemma 3, we required only A and B to be indecomposable, not C and D. Thus, this theorem follows immediately from Lemma 3 by mathematical induction.

5. Commutativity

We can see from the following example that × is not commutative in general. Let m = 6. Then, we have

2450 × 23 = 40125123

and

23 × 2450 = 45011223,

which are clearly not the same. Before we state the conditions for commutativity of indecomposable blocks, we introduce the following definition.

Definition. A block is called circular if it begins and ends with the same element.

Theorem 3 (Commutativity of Indecomposables) If the blocks A and B are indecomposable, then A × B = B × A if and only if at least one of the following conditions holds:

(i) A and B are cyclic of the same difference and circular. (ii) A or B has length 1. (iii) A ≅ B.

Proof. For convenience of notation, let α = |A| and β = |B| . We first show that each of conditions (i) − (iii) implies A × B = B × A. Suppose first that (i) holds, that is, we have

A [α − 1] = A [0] , B [β − 1] = B [0] ,  (19)

and there is some integer c such that for all integers j and k, with 1 ≤ j ≤ α − 1, 1 ≤ k ≤ β − 1,

A [j] − A [j − 1] ≡ B [k] − B [k − 1] ≡ c (mod m) .  (20)

By repeated applications of (20), we have, for all integers j and k, with 1 ≤ j ≤ α − 1, 1 ≤ k ≤ β − 1,

A [j] = A [0] ⊕ jc, and B [k] = B [0] ⊕ kc.  (21)

Setting j = α − 1 and k = β − 1 in (21), it follows from (19) that

(α − 1)c ≡ (β − 1) c ≡ 0 (mod m) .  (22)

We need to show that (A×B) [h] = (B ×A) [h] for all integers h with 0 ≤ h < |A × B| = αβ.

Let h be an integer such that 0 ≤ h < αβ. By the division algorithm, there exist unique integers q, r, s, and t, such that

h = qα + r = sβ + t, 0 ≤ r, s < α, 0 ≤ q, t < β.  (23)

Now, by (2), (21), (22) and (23) we have

(A × B) [h] = A [r] ⊕ B [q]
= A[0] ⊕ rc ⊕ B[0] ⊕ qc
= A [s] ⊕ B [t] ⊕ s (β − 1) c ⊕ q (1 − α) c
= A [s] ⊕ B [t]
= (B × A) [h] ,

as claimed.

We now suppose that (ii) holds. Without loss of generality, we may assume that α = 1. That is, A is the singleton block a, where a is a nonnegative integer smaller than m. By the definition of ×,

A × B = a × B = (a ⊕ B [0]) · (a ⊕ B(1)) · · · · · (a ⊕ B(β − 1))
= (B [0] ⊕ a) · · · · · (B [1] ⊕ a) · · · · · (B(β − 1) ⊕ a)
= B × a = B × A.

Finally, we suppose that (iii) holds. By the (second) definition of similarity, there exists an integer d, 0 ≤ d < m such that A = B × d. By the previous argument, the singleton block d commutes with B. Thus, we have

A × B = B × d × B = B × B × d = B × A.

We have shown that each of conditions (i)−(iii) imply that A and B commute. Now suppose that A × B = B × A. We will show that at least one of conditions (i) − (iii) holds. Suppose that condition (ii) does not hold so that A and B both have length greater than 1. Since A × B = B × A and A and B are indecomposable, Lemma 3 implies that either A ≅ B, which is condition (iii) , or A and B are both cyclic of the same difference. It remains only to show that in the case that A and B are both cyclic of the same difference but not similar, they are circular and thus condition (i) holds.

Let t be an integer, and assume A × B = B × A, A ≇ B, and A and B are both cyclic of difference t. Now α ≠ β, because two blocks that are cyclic of the same difference and have the same length are also similar. Without loss of generality, we may assume that α < β. By the definition of ×, we have

(A × B) [α − 1] = A [α − 1] ⊕ B [0]  and  (A × B) [α] = A [0] ⊕ B [1] .

Likewise, we have

(B × A) [α − 1] = B [α − 1] ⊕ A [0]  and  (B × A) [α] = B [α] ⊕ A [0] .

Since A × B = B × A, we have

A [α − 1] ⊕ B [0] = B [α − 1] ⊕ A [0]  (24)

and

A [0] ⊕ B [1] = B [α] ⊕ A [0] .  (25)

However, since B is cyclic of difference t,

B [1] − B [0] ≡ t ≡ B [α] − B [α − 1] (mod m) .  (26)

By (24), (25), and (26), we have

A [0] − A [α − 1] ≡ 0 (mod m) .

Since every element in A is from the set {0, 1, …, m − 1}, we have A [0] = A [α − 1] , and hence A is circular. We now show that B is also circular. We first note that α does not divide β, since if α divides β and they are both cyclic of the same difference, B is the product of A with some other block of length β/α, which contradicts the indecomposability of B. Let q and r be the unique nonnegative integers such that

β = qα + r, 0 ≤ r < α.

Since α does not divide β, r ≥ 1. By (2), we have

(A × B) [β − 1] = A [r − 1] ⊕ B [q]  and  (A × B) [β] = A [r] ⊕ B [q] .

Likewise, by the definition of ×, we have

(B × A) [β − 1] = B [β − 1] ⊕ A [0]  and  (B × A) [β] = B [0] ⊕ A [1] .

Since A × B = B × A, it follows that

A [r − 1] ⊕ B [q] = B [β − 1] ⊕ A [0]  (27)

and

A [r] ⊕ B [q] = B [0] ⊕ A [1] .  (28)

However, since A is cyclic of difference t,

A [1] − A [0] ≡ t ≡ A [r] − A [r − 1] (mod m) .  (29)

Therefore, from (27), (28), and (29), we have

B [0] − B [β − 1] ≡ 0 (mod m) .

Thus, B is circular and condition (i) holds.

References

[Ho] A. Hoit, The Distribution of Generalized Sum-of-Digits Functions, PhD thesis, Univ. of Illinois at Urbana-Champaign, 1999.

[Ja] K. Jacobs, “Maschinenerzeugte 0-1-folgen”, Chapter 1 of Selecta Mathematica, Vol. 1, Heidelberger Taschenbücher Band 49, Springer-Verlag, 1969, pp. 1–27.

[Ke] M. Keane, Generalized Morse Sequences, Z. Wahrscheinlichkeitstheorie und Verw. Gebiete, 10 (1968), 335–353.

[Lo] M. Lothaire, Combinatorics on words (A collective work by Dominique Perrin, Jean Berstel, Christian Choffrut, Robert Cori, Dominique Foata, Jean Eric Pin, Guiseppe Pirillo, Christophe Reutenauer, Marcel-P. Schützenberger, Jacques Sakarovitch and Imre Simon), Encyclopedia of Mathematics and its Applications, 17, Addison-Wesley Publishing Co., Reading, Mass, 1983.