Next Article in Journal
Prevention of Hazards Induced by a Radiation Fireball through Computational Geometry and Parametric Design
Previous Article in Journal
Likelihood Function through the Delta Approximation in Mixed SDE Models
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Multidimensional Fibonacci Coding

by
Perathorn Pooksombat
1,
Patanee Udomkavanich
2 and
Wittawat Kositwattanarerk
1,3,*
1
The Department of Mathematics, Faculty of Science, Mahidol University, Bangkok 10400, Thailand
2
The Department of Mathematics and Computer Science, Faculty of Science, Chulalongkorn University, Bangkok 10330, Thailand
3
The Centre of Excellence in Mathematics, The Commission on Higher Education, Bangkok 10400, Thailand
*
Author to whom correspondence should be addressed.
Submission received: 22 December 2021 / Revised: 20 January 2022 / Accepted: 21 January 2022 / Published: 27 January 2022

Abstract

:
Fibonacci codes are self-synchronizing variable-length codes that are proven useful for their robustness and compression capability. Asymptotically, these codes provide better compression efficiency as the order of the underlying Fibonacci sequence increases but at the price of the increased suffix length. We propose a circumvention to this problem by introducing higher-dimensional Fibonacci codes for integer vectors. The resulting multidimensional Fibonacci coding is comparable to the classical one in terms of compression; while encoding several numbers all at once for a shared suffix generally results in a shorter codeword, the efficiency takes a backlash when terms from different orders of magnitude are encoded together. In addition, while laying the groundwork for the new encoding scheme, we provide extensive theoretical background and generalize the theorem of Zeckendorf to higher order. As such, our work unifies several variations of Zeckendorf’s theorem while also providing new grounds for its legitimacy.

1. Introduction

A fundamental idea in data compression is to assign shorter codewords to symbols or groups of symbols that appear with higher probability in the source data [1]. This results in what is called a variable-length code, meaning that the length of each codeword may not be equal, and one of the earliest practical codes of such nature are the Huffman codes [2]. This code approaches theoretical compression limit under certain scenarios [1] and has recently been amended to create Tagged Huffman Codes [3] and End-Tagged Dense Codes [4] to accommodate database searches.
Popular alternatives to these codes are codes with suffix delimiters, where certain patterns mark the end of a codeword [5]. A competent example in this class of codes is the Fibonacci code, which is a result of a binary numeration system for the integers known as Zeckendorf representation. The scheme was introduced by [6] and generalized to a higher order in [7]. In terms of data compression, Fibonacci codes are optimal under some distributions and can be used as alternatives to Huffman codes [1,8]. Fibonacci codes are naturally suitable for integer data, where fast encoding and decoding algorithms can be implemented [9,10,11]. In addition, compared with other variable-length codes for the integers such as logarithmic ramp [12] and Elias codes [13], Fibonacci codes provide much better resistance against insertion and deletion errors. Other applications of the Fibonacci sequence in information science include the study of Morse code as a monoid [14,15], Wavelet trees [16], and zero-knowledge cryptography [17].
While suffix codes have been shown to offer adjustability to some extent [5], a great burden for a code with suffix delimiters to bear is its own suffix. A longer suffix gives more flexibility in the coded data, hence yielding denser codes, but obviously the codewords now have to carry longer appendage. This is particularly the case for the Fibonacci codes of higher order [18]. In this paper, we introduce Fibonacci coding for a sequential string of integers. In the proposed scheme, a constituent of integers is encoded together with a single delimiter, thus making Fibonacci codes of higher order more practical.
To generalize Fibonacci codes to the full extent, we re-examine their origin, which is the theorem of Zeckendorf. This much-celebrated theorem states that every positive integer n can be written uniquely as:
n = F i 1 + F i 2 + + F i j
where the F i s are Fibonacci numbers and i 1 , i 2 i 1 , , i j i j 1 2 . In other words, one may represent a positive integer as sum of nonconsecutive Fibonacci numbers. This theorem has been generalized and investigated in many directions; similar results can be stated for the negaFibonacci sequence [19,20], the generalized Fibonacci sequence of order k [21,22], and linear recurrence sequences [23,24]. The distribution of the number of terms in a Zeckendorf decomposition is studied in [25,26,27], where a probabilistic approach has recently been applied [28].
Meanwhile, the Fibonacci sequence itself has also been generalized in many directions. Here, noninteger Fibonacci sequences have been studied mostly on the complex numbers [29,30]. In particular, Jordan [31] and Harman [32] consider Fibonacci sequences whose initial terms and indices are Gaussian integers. Other generalizations usually involve an identity whose integer terms yield the classical Fibonacci numbers. For example, Binet’s formula is exploited in [33,34] where a Fibonacci function is defined over the real and complex numbers.
In this paper, we are interested in a generalization of Zeckendorf’s theorem in its purest form: We consider any mathematical sequences that satisfy the generalized Fibonacci recurrence relation and examine elements that can be written as a sum of terms from the sequence. As a result, mathematical spaces with minimal structure that meet our requirement are the free Z -modules. Loosely speaking, they are spaces of vectors with integer components. This choice of spaces allows our generalizations to encompass, for example, integer vectors, arrays, or blocks of integers of fixed length; Gaussian and Eisenstein integers; lattices; and the ring Z [ α ] , where α is algebraic.
We summarize the contributions of this paper as follows:
  • We introduce the notion of k-equivalent sequences. This approach technically treats elements that can be generated from a Fibonacci sequence as a number system using sequence elements as a basis. This key mechanism allows us to manipulate the “digits” of a representation of a number without an explicit knowledge of the underlying Fibonacci sequence. We prove that an element has a Zeckendorf decomposition if and only if it can be written as a finite sum (with multiplicities) of sequence elements.
  • We provide a necessary and sufficient condition for Zeckendorf’s theorem to hold in a free Z -module. Obviously, the classical Zeckendorf’s theorem can be viewed as a case of our generalization. We also give a sufficient condition that makes the representation unique.
  • We propose multidimensional Fibonacci coding for free Z -modules along with a natural and explicit encoding and decoding algorithm. This is the first work that makes possible native Fibonacci coding for non-integers. Not only that, the resulting codes inherit their robustness property from the standard Fibonacci codes, and they excel in terms of compression efficiency. We demonstrate both theoretically and numerically that the performance on the compression of multidimensional Fibonacci coding is comparable to the classical Fibonacci coding. The proposed scheme has an advantage in that the suffix now appears less frequently, thus cutting down on extraneous bits. However, it can be disadvantageous when a large integer appears together with a small integer in the source vector data. In such case, the larger integer could unproportionally drive up the length of the codeword.
The remainder of this paper is organized as follows. Section 2 sets the definitions that will be used throughout the paper. In Section 3, we prove several useful results concerning k-equivalent sequences. Generalizations of Zeckendorf’s theorem are given in Section 4. We establish multidimensional Fibonacci coding in Section 5, discuss its efficiency and demonstrate simulation results in Section 6, and conclude in Section 7.

2. Definitions and Terminologies

We first give a definition for free modules and Fibonacci sequences of higher order. A free Z -module is a module over Z with a basis. Namely, M is a free Z -module of rank l if it is a group under addition and
M = α 1 Z α 2 Z α l Z
for some α 1 , α 2 , , α l that are integrally independent, meaning that the only integer solution to the equation n 1 α 1 + n 2 α 2 + + n l α l = 0 is n 1 = n 2 = = n l = 0 . The elements α 1 , α 2 , , α l are called a basis for M, and every element of M can be written uniquely as: n 1 α 1 + n 2 α 2 + + n l α l , where n 1 , n 2 , , n l Z . For n Z + and m M , we write n m to mean m + m + + m n times . Note that multiplication between module elements may or may not be defined.
We are interested in an extremely broad version of a Fibonacci sequence, so we adopt only the fundamental recurrence relation and a corresponding generalization of a Zeckendorf representation.
Definition 1.
A Fibonacci sequence of order k is a doubly infinite sequence:
( F r ) r Z = ( , F 1 , F 0 , F 1 , )
where
F n k + + F n 2 + F n 1 = F n
for all integers n.
Here, a doubly infinite sequence (also called two-way infinite sequence) is a sequence that goes in both directions.
Definition 2.
Let ( F r ) r Z be a Fibonacci sequence of order k. An element m is Zeckendorf in ( F r ) if it can be written as a finite sum of terms in ( F r ) with no k consecutive terms. A set M is Zeckendorf in ( F r ) if every element of M is.
Note that we do not specify the initial condition for a Fibonacci sequence of order k. In fact, we will reverse engineer the theorem of Zeckendorf and identify all initial conditions that the theorem holds. In other words, instead of proving a version of Zeckendorf’s theorem for a particular sequence, we set forth to classify all sequences that are in favor of the theorem.
A Fibonacci sequence of order k has degree of freedom k; knowing any k consecutive terms is sufficient to generate the entire sequence. For k 2 , the characteristic polynomial of a Fibonacci sequence of order k is x k x k 1 x k 2 x 1 . It is known [35] that this polynomial has k distinct roots λ k , λ k , 2 , , λ k , k , where λ k ( 1 , 2 ) and λ k , 2 , , λ k , k lie in the unit circle. Note that the sequence ( λ k r ) r Z is a special case of Fibonacci sequence of order k. We call this sequence primitive.
Example 1.
In this example, we consider several Fibonacci sequences of order 3 (with respect to a different initial conditions for F 0 , F 1 , and F 2 ):
  • The usual Tribonacci sequence is defined using F 0 = F 1 = 1 , F 2 = 2 , and F n 3 + F n 2 + F n 1 = F n . The first few terms of this sequence are:
    1 , 1 , 2 , 4 , 7 , 13 , 24 , 44 , 81 , 149 , 274 , .
    The doubly infinite generalization of this sequence is given by:
    , 5 , 8 , 4 , 1 , 3 , 2 , 0 , 1 , 1 , 0 , 0 ,
    1 , 1 , 2 , 4 , 7 , 13 , 24 , 44 , 81 , 149 , 274 , .
  • The three roots of a polynomial x 3 x 2 x 1 are λ 3 1.839 , λ 3 , 2 0.42 0.606 i , and  λ 3 , 3 0.42 + 0.606 i . The primitive Fibonacci sequence of order 3 is the sequence ( λ 3 r ) r Z , which is approximately:
    , 0.161 , 0.296 , 0.544 , 1 , 1.839 , 3.383 , 6.222 , 11.445 , 21.05 , .
  • A Fibonacci sequence of order 3, where F 0 = 0 , F 1 = 1 + i , and F 2 = 2 + i is given by:
    , 5 + i , 2 3 i , 1 + 2 i , 2 , 1 i , i , 1 , 0 , 1 + i , 2 + i , 3 + 2 i , 6 + 4 i , 11 + 7 i , 20 + 13 i , .
    Here, the element of this sequence are Gaussian integers, i.e., complex numbers of the form a + b i , where a , b Z . The element 9 + 5 i , for example, is Zeckendorf in this sequence since 9 + 5 i = ( 5 + i ) + ( 1 + 2 i ) + ( 2 ) + ( 3 + 2 i ) = F 7 + F 5 + F 4 + F 3 .
In order to study elements that are Zeckendorf in ( F r ) , it is natural to consider elements of the form ( x r ) · ( F r ) , where ( x r ) is a doubly infinite sequence of integers and · is an infinite dot product, i.e.:
( x r ) · ( F r ) = r Z x r F r .
Roughly speaking, a collection of all elements of the form ( x r ) · ( F r ) is a number system with the base ( F r ) with the digit set Z . Here, ( x r ) acts like digits or coefficients for the basis ( F r ) . These so-called coefficients can be manipulated using the following methods.
Definition 3.
Let k > 1 be an integer. Doubly infinite sequences ( x r ) and ( y r ) are k-equivalent, denoted as ( x r ) k ( y r ) , if ( y r ) can be obtained from ( x r ) using finite applications of the following two operations:
Operation 1: For some n Z , subtract 1 from x n and add 1 to all of x n k , , x n 2 , x n 1 .
Operation 2: For some n Z , add 1 to x n and subtract 1 from all of x n k , , x n 2 , x n 1 .
It is not hard to see that Operations 1 and 2 “cancel out”, and k is an equivalence relation. These operations also preserve the value of the dot product: If ( F r ) is a Fibonacci sequence of order k and ( x r ) k ( y r ) , then ( x r ) · ( F r ) = ( y r ) · ( F r ) . As we will see later, this observation is an important ingredient of our results. Finally, we give a lexicographical order ≻ to doubly infinite sequences that are zero almost everywhere, i.e., ( x r ) r Z ( y r ) r Z if the term of ( x r ) is larger than that of ( y r ) at the rightmost index, where they are not equal. Here, a sequence is zero almost everywhere if the number of its nonzero terms is finite.

3. Properties of k-Equivalent Sequences

In a way, our approach in proving a generalized theorem of Zeckendorf is in asking the following converse question: Given a Fibonacci sequence ( F r ) of order k, which elements can be written as a finite sum of elements from ( F r ) using no k consecutive terms? It is not hard to see that they are elements of the form ( y r ) · ( F r ) where ( y r ) is binary, is 0 almost everywhere, and has no k consecutive 1’s. Now, instead of characterizing these elements directly, we will focus on manipulating the coefficients ( y r ) using Operations 1 and 2 from Definition 3. These coefficient manipulations operate independently of the underlying Fibonacci sequence ( F r ) of order k, and so this approach frees us from having to worry about the choice of ( F r ) . As we will see, our results hold in a broad sense and are not limited to just any specific Fibonacci sequence. Propositions 1 and 2 given in this section will provide an effective mechanism for identifying sequences that are k-equivalent to a binary sequence with the required properties.
Proposition 1.
For any sequence ( x r ) r Z of integers that is 0 almost everywhere, there exists a sequence ( y r ) r Z such that ( x r ) k ( y r ) , and ( y r ) r Z is either:
  • Zero everywhere;
  • Positive at some k consecutive terms and zero elsewhere;
  • Negative at some k consecutive terms and zero elsewhere.
In addition, if ( x r ) r Z ( 0 ) r Z is non-negative, then the k consecutive nonzero terms of ( y r ) r Z are positive.
Proof. 
A finite contiguous subsequence of ( x r ) r Z is called a cluster if the terms in its complement subsequence are all 0. In other words, ( x s , x s + 1 , x s + 2 , , x t 1 , x t ) is a cluster of ( x r ) r Z if x r = 0 for all r < s and all r > t . The number of terms in a cluster is called the size of the cluster. In addition, note that a cluster may contain, begin, or end with a 0.
A sequence ( x r ) r Z must have a cluster since it is 0 almost everywhere. Now, if the size of the cluster is greater than k, then one may apply either Operation 1 or 2 from Definition 3 to eliminate the rightmost nonzero term of ( x r ) , hence reducing the size of the cluster. Therefore, ( x r ) is k-equivalent to a sequence ( y r ) whose cluster size is k. If the terms of the cluster of ( y r ) are all positive, negative, or zero, then we are done. Otherwise, one may continue eliminating the rightmost nonzero term the sequence and, as a result, shift the index of the cluster by 1. We formalize this process as follows.
Initialize ( 0 ) y r = ( y r ) , and let ( 0 ) Γ = ( 0 ) y s , ( 0 ) y s + 1 , , ( 0 ) y s + k 1 be a cluster of ( 0 ) y r :
  • If ( 0 ) y s + k 1 > 0 , we apply Operation 1 to eliminate ( 0 ) y s + k 1 and obtain another sequence ( 1 ) y r . Here, ( 0 ) y r k ( 1 ) y r . The cluster of ( 1 ) y r has size k, but its index has shifted from that of ( 0 ) y r by 1. Namely, the cluster of ( 1 ) y r is:
    ( 1 ) Γ = ( 1 ) y s 1 , ( 1 ) y s , , ( 1 ) y s + k 2 = ( 0 ) y s + k 1 , ( 0 ) y s + ( 0 ) y s + k 1 , ( 0 ) y s + 1 + ( 0 ) y s + k 1 , , ( 0 ) y s + k 2 + ( 0 ) y s + k 1 .
  • If ( 0 ) y s + k 1 < 0 , we apply Operation 2 to eliminate ( 0 ) y s + k 1 and obtain another sequence ( 1 ) y r . Incidentally, since ( 0 ) y s + k 1 is negative, the cluster of ( 1 ) y r also follows from the Equation (1).
  • If ( 0 ) y s + k 1 = 0 , let ( 1 ) y r = ( 0 ) y r and:
    ( 1 ) Γ = ( 1 ) y s 1 , ( 1 ) y s , , ( 1 ) y s + k 2 = ( 0 ) y s 1 , ( 0 ) y s , , ( 0 ) y s + k 2 = ( 0 ) y s + k 1 , ( 0 ) y s + ( 0 ) y s + k 1 , ( 0 ) y s + 1 + ( 0 ) y s + k 1 , , ( 0 ) y s + k 2 + ( 0 ) y s + k 1
    where the last equality follows from the fact that ( 0 ) y s 1 = ( 0 ) y s + k 1 = 0 .
It follows that, in all cases:
( 1 ) Γ = A · ( 0 ) Γ
where:
A = 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1
and ( 0 ) Γ , ( 1 ) Γ are taken as a 1 × k vector. This process can be repeated indefinitely, resulting in a collection of k-equivalent sequences ( 0 ) y r , ( 1 ) y r , ( 2 ) y r , . The cluster size of these sequences is k, but the index of the cluster is continually shifted. Here, the clusters are collected as ( 0 ) Γ , ( 1 ) Γ , ( 2 ) Γ , . It follows that ( n ) Γ = A n · ( o ) Γ , and it remains to show that there is an n for which A n · ( o ) Γ is either all positive, negative, or zero.
It should not be surprising that A is the transpose of the usual Fibonacci matrix. Thus, A has a characteristic equation x k x k 1 x k 2 x 1 and eigenvalues λ k , 1 , , λ k , k , where λ k = λ k , 1 ( 1 , 2 ) and the complex norm of λ k , 2 , , λ k , k is less than 1 [35]. We denote by v i an eigenvector corresponding to the eigenvalue λ k , i . Note that:
v 1 = λ k k 2 λ k k 2 + λ k k 3 λ k k 2 + λ k k 3 + λ k k 4 λ k k 2 + λ k k 3 + + λ k + 1 λ k k 1
is real and positive. Now, one may diagonalize A as C D C 1 , where D = diag ( λ k , λ k , 2 , , λ k , k ) and C = v 1 v k . It follows that:
( n ) Γ = A n · ( o ) Γ = C D n C 1 · ( o ) Γ = λ k n v 1 λ k , 2 n v 1 λ k , k n v k C 1 · ( o ) Γ = λ k n c 1 v 1 + λ k , 2 n c 2 v 2 + + λ k , k n c k v k
where ( c 1 , , c k ) = C 1 · ( o ) Γ . Here, λ k n c 1 v 1 is the dominant term in the sum. Specifically, let Λ = max { | λ k , 2 | , , | λ k , k | } < 1 and V = max { | c 2 v 2 | , , | c k v k | } . Thus,
| λ k , 2 n c 2 v 2 + + λ k , k n c k v k | < ( k 1 ) Λ n V .
It follows that if n is a positive integer such that ( k 1 ) Λ n V < 1 2 , then ( n ) Γ is the integer vector that is closest to λ k n c 1 v 1 . Since v 1 is real and positive, all entries of ( n ) Γ will have the same sign as c 1 . This completes the proof that ( n ) Γ = A n · ( o ) Γ can be made all positive, negative, or zero.
For the last part of the proposition, if ( x r ) r Z ( 0 ) r Z is non-negative, then we only need to use Operation 1, and so the cluster of ( y r ) r Z cannot be negative or zero.    □
Proposition 2.
For any sequence ( x r ) r Z of non-negative integers that is 0 almost everywhere, there exists a sequence ( y r ) r Z of 0 and 1 with no k consecutive 1’s such that ( x r ) k ( y r ) .
Proof. 
Consider all sequences of non-negative integers that are k-equivalent to ( x r ) r Z . Recall that if ( x r ) k ( y r ) , then ( x r ) · ( λ k r ) = ( y r ) · ( λ k r ) , where ( λ k r ) is the primitive Fibonacci sequence of order k. Let N be an integer such that ( x r ) · ( λ k r ) < λ k N . Now, if a sequence of non-negative integers ( y r ) is k-equivalent to ( x r ) , then we must have ( y r ) · ( λ k r ) < λ k N . Since ( λ k r ) is strictly positive, it follows that y r = 0 for all r N . This allows us to conclude that, among all the sequences of non-negative integers that are k-equivalent to ( x r ) , there must be one with the highest lexicographical order. We call this sequence ( y r ) r Z and claim that it satisfies the conditions required.
Suppose that y s 2 for some s Z . We perform Operation 1 at n = s and Operation 2 at n = s + 1 . This results in a sequence with higher lexicographical order than ( y r ) , contradicting our choice of ( y r ) . Suppose now that y s k = = y s 2 = y s 1 = 1 for some s Z . Perform Operation 2 at n = s yields a sequence with higher lexicographical order, and once again that contradicts the choice of ( y r ) . We conclude that ( y r ) consists only of 0 and 1 with no k consecutive 1’s.    □
We illustrate the transformations given in Propositions 1 and 2 in an example below.
Example 2.
We let k = 3 and consider a doubly infinite sequence ( x r ) that is zero everywhere except x 1 = 2 , x 1 = 1 , x 2 = 2 , and x 4 = 1 , i.e.:
( x r ) = ( , 2 1 , 0 0 , 1 1 , 2 2 , 0 3 , 1 4 , ) .
Here, and throughout the example, indices are shown as subscript for improved readability. We now transform ( x r ) into a sequence that is positive at some three consecutive terms and zero elsewhere:
( , 2 1 , 0 0 , 1 1 , 2 2 , 0 3 , 1 4 , ) 3 ( , 2 1 , 0 0 , 0 1 , 1 2 , 1 3 , 0 4 , ) 3 ( , 2 1 , 1 0 , 1 1 , ) 3 ( , 1 2 , 1 1 , 2 0 , 0 1 ) 3 ( , 1 3 , 2 2 , 0 1 , 1 0 , 0 1 , ) . 3 ( , 2 3 , 3 2 , 1 1 , 0 0 , 0 1 , ) .
Here, Operation 1 is performed at indices 4,3,1,0,0 in order. Next, we transform
( , 2 3 , 3 2 , 1 1 , ) into a binary sequence with no three consecutive ones:
( , 2 3 , 3 2 , 1 1 , ) 3 ( , 1 3 , 2 2 , 0 1 , 1 0 , ) 3 ( , 1 5 , 1 4 , 2 3 , 1 2 , 0 1 , 1 0 , ) 3 ( , 1 5 , 0 4 , 1 3 , 0 2 , 1 1 , 1 0 , ) .
Here, Operations 2,1,2 are performed in order at indices 0 , 2 , 1 , respectively. Consider now a Fibonacci sequence of order 3 of Gaussian integers:
( F r ) = ( , ( 1 + 2 i ) 5 , ( 2 ) 4 , ( 1 i ) 3 , ( i ) 2 , ( 1 ) 1 , ( 0 ) 0 , ( 1 + i ) 1 , ( 2 + i ) 2 , ( 3 + 2 i ) 3 , ( 6 + 4 i ) 4 , )
from Example 1. Again, parentheses and subscript are added for readability. Note that all the above three-equivalent sequences represent the same quantity when multiplied by ( F r ) . In particular, if ( y r ) = ( , 2 3 , 3 2 , 1 1 , ) and ( z r ) = ( , 1 5 , 0 4 , 1 3 , 0 2 , 1 1 , 1 0 , ) , then
( x r ) · ( F r ) = ( y r ) · ( F r ) = ( z r ) · ( F r ) = 1 + i .
Indeed, the fact that ( x r ) · ( F r ) = ( y r ) · ( F r ) = ( z r ) · ( F r ) would hold for any other Fibonacci sequences ( F r ) of order 3.
The last example illustrates a major strength of our approach–each equivalency class represents the same quantity under a given Fibonacci sequence. If one can find a legitimate Zeckendorf representation in an equivalency class, then the element represented by that class has a Zeckendorf decomposition. We finish this section with a powerful corollary to Proposition 2 and another example. The next result characterizes all elements that are Zeckendorf in a Fibonacci sequence ( F r ) of order k.
Corollary 1.
Let ( F r ) be a Fibonacci sequence of order k. An element m is Zeckendorf in ( F r ) if and only if m can be written as a finite sum (with multiplicities) of elements from ( F r ) .
Proof. 
An element m is a finite sum of elements from ( F r ) if it is Zeckendorf in ( F r ) . The converse of this statement follows from Proposition 2.    □
Example 3.
Consider the primitive Fibonacci sequence of order 2:
, φ 3 , φ 2 , φ 1 , 1 , φ , φ 2 , φ 3 ,
where φ = 1 + 5 2 is the golden ratio. The elements that are Zeckendorf in this sequence are precisely positive elements in the ring Z [ φ ] , and this numeration system is known as the golden ratio base.

4. Zeckendorf’s Theorem for Free Z -Modules

Intuitively, if an element m is Zeckendorf in a Fibonacci sequence ( F r ) of order k, then it is an integer combination of the initial terms (or, in fact, any k terms) of ( F r ) . The integer span of these forms a module, so it is natural to attempt to represent every element of a module using sequence elements. The Section 4.1 below deals with doubly infinite Fibonacci sequences using tools developed in the previous section. The result is then specialized to one-way Fibonacci sequences in Section 4.2. This paves the way for the Zeckendorf decomposition and Fibonacci coding for modules.

4.1. Two-Sided Sequences

Corollary 1 lays a strong foundation for our work. While it characterizes elements that are Zeckendorf in a sequence, it gives insufficient information on the algebraic structure of the set of all elements that have a legitimate representation. The following theorem now reverses the process. It gives a sufficient and necessary condition for every element of a free Z -module M to be Zeckendorf in a Fibonacci sequence ( F r ) .
Theorem 1.
Let M be a free Z -module of rank l and ( F r ) r Z = ( , F 1 , F 0 , F 1 , ) be a Fibonacci sequence of order k. Then, M is Zeckendorf in ( F r ) if and only if both of the following conditions are satisfied:
  • F i , , F i + k 1 span M for all i;
  • l < k .
Proof. 
We first remark that the integral span of F i , , F i + k 1 is the same as the integral span of F i + 1 , , F i + k since F i + + F i + k 1 = F i + k . Thus, F i , , F i + k 1 span M for alli if and only if F i , , F i + k 1 span M for anyi.
It is easy to see that the first condition is necessary. Since the elements of ( F r ) r Z are integer combinations of F i , , F i + k 1 , so must be any sums of the elements from this sequence. It follows that F i , , F i + k 1 span M. This readily implies l k . We will now show that l cannot be equal to k, thus establishing the necessity of the second condition.
Suppose that l = k , and let m be any nonzero element of M. Since both m and m are Zeckendorf in ( F r ) , we have:
m = ( x r ) · ( F r ) and m = ( y r ) · ( F r )
for some sequences ( x r ) , ( y r ) of 0 and 1 with no k consecutive 1’s. Hence, 0 = ( x r + y r ) · ( F r ) . By Proposition 1, ( x r + y r ) is k-equivalent to a sequence that is positive at some k consecutive terms and zero elsewhere. Thus, we have:
0 = ( x r + y r ) · ( F r ) = ( z r ) · ( F r ) = z i F i + z i + 1 F i + 1 + + z i + k 1 F i + k 1
for some i, in which z i , z i + 1 , , z i + k 1 > 0 . This, however, means that F i , F i + 1 , , F i + k 1 are integrally dependent, and so they cannot span a module of rank l = k .
We are left to show that the two conditions are sufficient. Since F 0 , , F k 1 spans M and l + 1 k , F 1 , , F k 1 must be integrally dependent. That is, we may write:
0 = x 0 F 0 + + x k 1 F k 1
where x 0 , , x k 1 are not all zeros. In other words, we have:
0 = ( x r ) · ( F 1 )
where ( x r ) is zero everywhere except for some k consecutive terms. We apply Proposition 1 and obtain a sequence ( y r ) that is k-equivalent to ( x r ) and contains k consecutive terms of the same sign and zero elsewhere. Note that ( y r ) cannot be zero everywhere since that would imply that x 0 = = x k 1 = 0 .
Suppose now that ( y r ) is nonzero at the terms y i , , y i + k 1 . This means:
0 = y i F i + + y i + k 1 F i + k 1
where either y i , , y i + k 1 > 0 or y i , , y i + k 1 < 0 . Since F i , , F i + k 1 spans M, we can write any element m M as:
m = z i F i + + z i + k 1 F i + k 1
where z i , , z i + k 1 are integers. Now, we have:
m = m + 0 · N = ( z i + y i N ) F i + + ( z i + k 1 + y i + k 1 N ) F i + k 1
for all integers N. For a sufficiently large (and possibly negative) N, the terms z i + y i N , , z i + k 1 + y i + k 1 N will all be positive, and it follows from Corollary 1 that m is Zeckendorf in ( F r ) . This completes the proof of the theorem.    □
Corollary 2.
Let ( F r ) r Z = ( , F 1 , F 0 , F 1 , ) be a Fibonacci sequence of order k. If F 1 , , F k are integrally dependent, then every element in the integral span of F 1 , , F k is Zeckendorf in ( F r ) .
In view of Theorem 1, every integer has a (classical) Zeckendorf representation since Z is a module over itself with rank 1, and the negaFibonacci sequence is of order 2 with F 0 = 0 and F 1 = 1 . In fact, the same result would hold as long as F 0 and F 1 are relatively prime (and hence span Z integrally). This is technically the case for the Lucas sequence where L 0 = 2 and L 1 = 1 . Next, we give an example for the case of Gaussian integers.
Example 4.
Consider a Fibonacci sequence:
, ( 2 3 i ) 6 , ( 1 + 2 i ) 5 , ( 2 ) 4 , ( 1 i ) 3 , ( i ) 2 , ( 1 ) 1 , ( 0 ) 0 , ( 1 + i ) 1 , ( 2 + i ) 2 , ( 3 + 2 i ) 3 , ( 6 + 4 i ) 4 , ( 11 + 7 i ) 5 ,
of order 3 from Example 1. It follows from Theorem 1 that every Gaussian integer can be written as a sum of elements from this sequence with no 3 consecutive terms. For instance:
2 = ( 2 3 i ) 6 + ( 1 + 2 i ) 5 + ( i ) 2 + ( 1 ) 1 2 i = ( 2 3 i ) 6 + ( 2 ) 4 + ( i ) 2 1 = ( 1 i ) 3 + ( i ) 2 i = ( 1 i ) 3 + ( 1 ) 1 2 = ( 2 ) 4 2 i = ( 1 + 2 i ) 5 + ( 1 ) 1 3 = ( 2 ) 4 + ( 1 ) 1 3 i = ( 1 + 2 i ) 5 + ( i ) 2 + ( 1 ) 1 1 + 2 i = ( 1 + 2 i ) 5 + ( 2 ) 4 1 2 i = ( 2 3 i ) 6 + ( i ) 2 + ( 1 ) 1 2 + i = ( 1 + 2 i ) 5 + ( 1 i ) 3 2 i = ( 2 3 i ) 6 + ( 1 + 2 i ) 5 = + ( 1 ) 1 .
One may observe that ( i ) 2 + ( 1 ) 1 = ( 1 + i ) 1 , and so the Zeckendorf representation for a Gaussian integer in this sequence is not unique. Nonetheless, we will see in the next subsection how certain adjustments can make unique representations possible.
On the contrary, no Fibonacci sequence of order 2 can generate all Gaussian integers. For example, 1 i cannot be written as a sum of elements from the sequence:
, 21 + 13 i , 13 8 i , 8 + 5 i , 5 3 i , 3 + 2 i , 2 i , 1 + i , 1 , i , 1 + i , 1 + 2 i , 2 + 3 i , 3 + 5 i , 5 + 8 i , .
Note that Corollary 2 does not apply here since 1 and i are not integrally dependent. However, it follows from Corollary 1 that every element of the form a + b i , a , b Z + , is Zeckendorf in this sequence.

4.2. One-Sided Sequences and Unique Representation

For dense code, we need a one-to-one mapping. However, we see in Example 4 that a two-sided sequence do not provide such luxury. Note that this is observed in the classical Fibonacci sequence as well. It is only when the negaFibonacci sequence is extracted from the two-sided infinite sequence:
, 34 , 21 , 13 , 8 , 5 , 3 , 2 , 1 , 1 , 0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 ,
that every integer has a unique Zeckendorf representation. In this subsection, we establish analogous results for Fibonacci sequences of higher order. The key ingredient of this development is Corollary 3, which states that binary sequences with no k consecutive 1’s cannot be k-equivalent.
Lemma 1.
Let a be an integer, and let ( λ k r ) r Z be the primitive Fibonacci sequence of order k. Then:
r < a k a r λ k r = λ k a .
Proof. 
We have:
r < a k a r λ k r = r < a λ k r r < a k a r λ k r = λ k a λ k 1 λ k a λ k k 1 = λ k a ( λ k k 1 + λ k k 2 + + 1 ) 1 λ k k 1 = λ k a λ k k 1 λ k k 1 = λ k a .
   □
Corollary 3.
Let ( x r ) and ( y r ) be doubly infinite binary sequences with no k consecutive 1’s that are 0 almost everywhere:
  • If ( x r ) k ( y r ) , then ( x r ) · ( λ k r ) > ( y r ) · ( λ k r ) .
  • If ( x r ) k ( y r ) , then ( x r ) = ( y r ) .
Proof. 
Suppose that ( x r ) k ( y r ) , and let a be the largest index where ( x r ) and ( y r ) are not equal. It follows that ( x a ) = 1 , ( y a ) = 0 , and
( x r ) · ( λ k r ) λ k a + r > a x r λ k r = r < a k a r λ k r + r > a x r λ k r > r a y r λ k r + r > a y r λ k r = ( y r ) · ( λ k r ) .
Now, if ( x r ) ( y r ) , then we may assume without loss of generality that ( x r ) k ( y r ) . This means ( x r ) · ( λ k r ) > ( y r ) · ( λ k r ) , and so ( x r ) k ( y r ) . This readily establishes part 2.    □
Typically, ( x r ) k ( y r ) means that ( x r ) · ( F r ) = ( y r ) · ( F r ) , and so ( x r ) and ( y r ) are two representations of the same element. Corollary 3 now allows us to identify the Fibonacci sequences (or parts of them) that permit unique Zeckendorf representation: If a sequence ( F r ) has the property that ( x r ) · ( F r ) = ( y r ) · ( F r ) implies ( x r ) k ( y r ) , then any element that is Zeckendorf in ( F r ) will have a unique representation. Since we are interested in generating every element in a Z -module, we look into generalizing negaFibonacci sequence, which is technically a one-sided Fibonacci sequence to the left whose first excluded term is 0. It turns out that this observation generalizes well to modules.
Theorem 2.
Let k 2 be an integer and M be a free Z -module of rank k 1 . Let ( F r ) r Z = ( , F 1 , F 0 , F 1 , ) be a Fibonacci sequence of order k, where F 0 = 0 and F k + 1 , , F 1 span M. Then, every element m M can be uniquely written as a finite sum of elements from the one-way sequence:
, F 3 , F 2 , F 1
with no k consecutive terms.
Proof. 
We first prove the existence. Let m M and write:
m = x k + 1 F k + 1 + + x 2 F 2 + x 1 F 1
where x k + 1 , , x 2 , x 1 are integers. We extend x k + 1 , , x 2 , x 1 to a sequence ( x r ) r Z that is zero everywhere except r = k + 1 , , 2 , 1 . Now, consider all sequences of integers that are k-equivalent to ( x r ) r Z such that the terms with positive indices are zero, and the terms with negative indices are non-negative. Such a sequence exists since one may apply Operation 1 from Definition 3 to ( x r ) at n = 0 for max { | x k + 1 | , , | x 2 | , | x 1 | } times. We denote by ( y r ) r Z the sequence that has the aforementioned properties with highest lexicographical order. We claim that ( y r ) gives a Zeckendorf representation for m in , F 3 , F 2 , F 1 .
We first note that y r = 0 for r Z + and F 0 = 0 , and so ( y r ) · ( F r ) = r Z y r F r . If  y s 2 for some s Z , then we perform Operation 1 at n = s and Operation 2 at n = s + 1 to obtain a sequence with higher lexicographical order than ( y r ) . If y s k + 1 = = y s 1 = y s = 1 for some s Z , then performing Operation 2 at n = s results in a sequence with higher lexicographical order. Thus, ( y r ) is binary with no k consecutive 1’s, and r Z y r F r is a Zeckendorf representation for m in , F 3 , F 2 , F 1 .
Suppose now for the sake of contradiction that there exists an element m M that has two representations as a finite sum of elements from the sequence , F 3 , F 2 , F 1 with no k consecutive terms. That is, we have m = ( x r ) · ( F r ) = ( y r ) · ( F r ) where ( x r ) ( y r ) are doubly infinite binary sequences which are zero for r 0 . Now, we keep applying either Operation 1 or 2 to eliminate the leftmost nonzero term of ( x r ) and ( y r ) and obtain sequences ( x r ) and ( y r ) , which are zero everywhere except for r = k + 1 , , 2 , 1 , 0 . This means:
( x r ) · ( F r ) = x k + 1 F k + 1 + + x 2 F 2 + x 1 F 1 + x 0 F 0
and
( y r ) · ( F r ) = y k + 1 F k + 1 + + y 2 F 2 + y 1 F 1 + y 0 F 0 .
are both equal to m. Since F k + 1 , , F 1 span M of rank k 1 , we must have x r = y r for r = k + 1 , , 2 , 1 . If x 0 = y 0 , then ( x r ) k ( x r ) = ( y r ) k ( y r ) , and so ( x r ) and ( y r ) must be the same from Corollary 3. Otherwise, we assume without loss of generality that x 0 > y 0 . We now have:
( x r ) · ( λ k r ) ( y r ) · ( λ k r ) = ( x r ) · ( λ k r ) ( y r ) · ( λ k r ) = ( x 0 y 0 ) λ k 0 1 .
Since ( y r ) is binary, it follows that ( x r ) · ( λ k r ) 1 . However, we see the following from Lemma 1:
( x r ) · ( λ k r ) < r < 0 k r λ k r = λ k 0 = 1 ,
which is a contradiction. This completes the proof of the theorem.    □
Obviously, the generalized Zeckendorf theorem over the negaFibonacci sequence [19] serves as an instance of Theorem 2. We give another example using Gaussian integers.
Example 5.
Consider the following Fibonacci sequence:
, ( 2 3 i ) 6 , ( 1 + 2 i ) 5 , ( 2 ) 4 , ( 1 i ) 3 , ( i ) 2 , ( 1 ) 1 , ( 0 ) 0 , ( 1 + i ) 1 , ( 2 + i ) 2 , ( 3 + 2 i ) 3 , ( 6 + 4 i ) 4 , ( 11 + 7 i ) 5 ,
of order 3 from Examples 1 and 4. One can see that every representation given in Example 4 only involve terms from the sequence:
, ( 2 3 i ) 6 , ( 1 + 2 i ) 5 , ( 2 ) 4 , ( 1 i ) 3 , ( i ) 2 , ( 1 ) 1 .
In fact, every Gaussian integer can be uniquely written as a sum of elements from this sequence with no three consecutive terms. This property will be exploited when we develop multidimensional Fibonacci coding for Gaussian integers in Example 6 in the next section.

5. Multidimensional Fibonacci Coding

The classical Fibonacci code of order 2 is quite simple. By virtue of Zeckendorf’s theorem, integers are written in base Fibonacci and encoded as a string of 0’s and 1’s in reverse order together with a suffix 1. For example, 11 is encoded as 001011 since it is the sum of the third and the fifth Fibonacci numbers, which are 3 and 8, respectively. The widely-accepted Fibonacci code of higher order is not so straightforward. Note that simply adding consecutive runs of 1 no longer makes the code uniquely decodable [7]. The integers are instead mapped to a lexicographically ordered string of 0’s and 1’s with a single k-consecutive 1 at the end. This encoding, though artificial, provides dense codes.
We see from Theorem 2 that it is possible to write any element of a module as a sum of entries from a sequence using no k consecutive terms. This suggests a multidimensional Fibonacci coding for modules with the use of k consecutive 1’s as a separator. This intuition formalizes into Algorithm 1. Here, we denote k consecutive 1’s, 11 1 k , by 1 k .
Algorithm 1 Multidimensional Fibonacci Encoding
Input: A Fibonacci sequence , F 3 , F 2 , F 1 of order k where F k + + F 1 = 0 and F k + 1 , , F 1 span a free Z -module M of rank k 1 , and an element m M .
Output: multidimensional Fibonacci code for m.
1:
If m = 0 , output 1 k . END.
2:
Find the module coordinate of m under the basis F k + 1 , , F 1 . We will have
m = x k + 1 F k + 1 + + x 2 F 2 + x 1 F 1 .
Set x 0 = 0 and x r = 0 for r k .
3:
If x ˇ = min { x k + 1 , , x 2 , x 1 } < 0 , subtract x ˇ from x k , x k + 1 , , x 2 , x 1 .
4:
Find the largest index s < 0 such that x s k + 1 , , x s 1 . If there is none, go to Step 5. Otherwise, subtract 1 from x s k + 1 , , x s , add 1 to x s + 1 , and repeat this step.
5:
Find the largest index s < 0 such that x s 2 . If there is none, go to Step 6. Otherwise, subtract 2 from x s , add 1 to x s k and x s + 1 , and go to Step 4.
6:
Find the smallest index s < 0 such that x s = 1 . Output x 1 x 2 x 3 x s + 2 x s + 1 01 k . END.
Note that the coefficients are encoded in reverse order, and Step 2 may depend on the initial condition F k , , F 1 of the Fibonacci sequence of order k. If F k + 1 , , F 1 is chosen to be the standard basis of the module, then x k + 1 , , x 2 , x 1 will simply be the coordinate of m in the usually sense. Generally, one may also find x k + 1 , , x 2 , x 1 by solving (2) as a system of linear equations. In the final step, we replace the last 1 with 01 k to make our code uniquely decodable. This frees us from having to keep the lookup table but makes the code suboptimal in terms of density.
In addition, note that the algorithm simply mimics the arguments given in the proof of Theorem 2. This guarantees that the algorithm terminates since the operations performed in Step 4 and 5 increase the lexicographical order of the sequence. At every step, the value r Z x r F r remains unchanged. This fact makes the decoding, which is outlined as Algorithm 2, straightforward.
Algorithm 2 Multidimensional Fibonacci Decoding
Input: A Fibonacci sequence , F 3 , F 2 , F 1 of order k, and a binary string x 1 x 2 x 3 x s + 1 x s 1 k .
Output: An element m.
1:
If x 1 x 2 x 3 x s + 1 x s is empty, output 0. END.
2:
Output x 1 F 1 + x 2 F 2 + + x s + 1 F s + 1 + F s . END.
To illustrate, we consider once again the Gaussian Fibonacci sequence of order 3 used through Examples 1, 4 and 5.
Example 6.
Consider the following Fibonacci sequence:
, ( 4 + 4 i ) 8 , ( 5 + i ) 7 , ( 2 3 i ) 6 , ( 1 + 2 i ) 5 , ( 2 ) 4 , ( 1 i ) 3 , ( i ) 2 , ( 1 ) 1
of order 3, and let m = 2 + 3 i . To encode, we initialize x 2 = 3 , x 1 = 2 and obtain x 3 = 2 , x 2 = 5 , x 1 = 0 after Step 3. We shorthand this sequence as 2 3 , 5 2 , 0 1 . The iterations of Step 4 and 5 now yield:
2 3 , 5 2 , 0 1 1 5 , 0 4 , 2 3 , 3 2 , 1 1 1 5 , 0 4 , 1 3 , 2 2 , 0 1 2 5 , 0 4 , 1 3 , 0 2 , 1 1 1 8 , 0 7 , 0 6 , 0 5 , 1 4 , 1 3 , 0 2 , 1 1 .
Thus, m = 2 + 3 i is encoded as 10110000111. This string can then be decoded as F 1 + F 3 + F 4 + F 8 = ( 1 ) 1 + ( 1 i ) 3 + 2 4 + ( 4 + 4 i ) 8 = 2 + 3 i . The length of the encoded Gaussian integer a + b i where 1000 a , b 1000 under this initial condition is illustrated in Figure 1. Here, the region of the same color represents the Gaussian integer of the same encoded length using the basis given in this example.
Clearly, one may replace i in Example 6 with any other quadratic integer and obtain a multidimensional Fibonacci coding for the corresponding ring of quadratic integers. Next, we give an example of multidimensional Fibonacci coding for a lattice.
Example 7.
Consider the lattice E 8 given by:
E 8 = x Z 8 ( Z + 1 2 ) 8 x i 0 ( mod 2 ) .
This lattice provides optimal sphere packing and kissing number in eight dimensions and has many other interesting properties [36]. We set the basis for E 8 as:
v 1 = ( 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) v 2 = ( 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ) v 3 = ( 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 ) v 4 = ( 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 ) v 5 = ( 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 ) v 6 = ( 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 ) v 7 = ( 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 ) v 8 = ( 1 2 , 1 2 , 1 2 , 1 2 , 1 2 , 1 2 , 1 2 , 1 2 )
and consider a Fibonacci sequence of order 9 given by:
, 2 v 2 v 1 , 2 v 1 , v 1 v 2 v 3 v 4 v 5 v 6 v 7 v 8 , v 8 , v 7 , v 6 , v 5 , v 4 , v 3 , v 2 , v 1 .
It follows from Theorem 2 that every element of E 8 can be written as a sum of elements from this sequence with no nine consecutive terms. For example, let m = ( 1 2 , 1 1 2 , 1 1 2 , 1 2 , 1 2 , 1 2 , 1 2 , 1 2 ) E 8 . Then, m = v 1 + 2 v 2 + v 3 + v 8 = ( 2 v 2 v 1 ) + ( 2 v 1 ) + ( v 8 ) + ( v 3 ) and can be encoded as 00100001010111111111.

6. Compression Efficiency and Simulation Results

In this section, we give an overview for the compression efficiency of the proposed scheme, both theoretically and numerically. We refer interested readers to [1] for a comprehensive survey on the topic of data compression.
Let λ k be the dominating root of x k x k 1 x k 2 x 1 = 0 , i.e., the k th -order golden ratio. It takes approximately log λ k ( A ) + k 1 bits to encode a single integer A using the Fibonacci code of order k. Unfortunately, due to the erratic nature of the higher-order number system, a simple formula cannot be made to approximate the number of bits needed to encode the string A 1 , A 2 , , A k using our proposed algorithm (see also Figure 1). Here, we shall attempt to give a very crude estimate. Theorem 2 guarantees a one-to-one correspondence between modules element and sequences of 0’s and 1’s with no k consecutive 1’s. Consider a k-dimensional hypercube with sides parallel to the axes, and the origin and ( A 1 , A 2 , , A k ) are opposite vertices. It takes at least log λ k ( A 1 A 2 A k ) bits to assign each integer point in this hypercube a unique binary strings under multidimensional Fibonacci coding. Thus, if A 1 , A 2 , , A k are sufficiently large, one may estimate the number of bits needed to encode them altogether as log λ k ( A 1 A 2 A k ) + k . If A is the geometric mean of A 1 , A 2 , , A k , then the per-element average of the number of bits used to write each of the A i ’s is log λ k ( A ) + 1 . This can be interpreted as the burden of the k-bit suffix being shared across the string entries.
While there exist several modern compression techniques [3,4,5,37], each with different strengths and trade-offs, we compare a multidimensional Fibonacci code with the classical one, using the well-established Huffman code as a benchmark.
Figure 2 plots the average length of the codewords as a function of the number of elements in the source data on a logarithmic scale for Huffman, classical Fibonacci (Fib2, Fib3, Fib4), and multidimensional Fibonacci (MultiFib3, MultiFib4) coding. Next, we define the normalized compression ratio as the average codeword length divided by the entropy of the source data and present the comparison in this factor in Figure 3. Here, we see that multidimensional Fibonacci codes outperform their classical counterpart across all orders when n is sufficiently large (≈100). This is not surprising, since the burden of the suffix is shared across several alphabets in the proposed scheme.
Next, Figure 4 and Figure 5 consider the case when the distribution of the source data follows Zipf’s law, which is known to typically govern the distribution of letters and words in a natural language [38]. Here, it turns out that the performance of multidimensional Fibonacci codes are slightly behind their classical counterparts. This phenomenon could probably be explained by the fact that multidimensional encoder receives a hold-back when “frequent” and “infrequent” alphabets are encoded together in the same group. We give a quick example to illustrate this circumstamce.
Example 8.
Suppose that three strings 2 2, 10 10, and 10 2 are to be encoded with the classical and multidimensional Fibonacci coding of order 3 (Fib3 and MultiFib3, respectively), where Fib3 encodes each number separately and MultiFib3 encodes the two numbers together. The results are given in Table 1.
Here, MultiFib3 performs better when the input integers are equally large but gains no reduction in codeword length when one of the inputs is significantly reduced.
To this end, multidimensional Fibonacci coding takes us to a strange paradox where encoding a constituent of data as whole reduces the use of delimiter, thus improving upon the compression rate. However, as the encoding is performed collectively rather than individually, the system suffers a disadvantage when numbers that are considerably different in magnitude are encoded together. This could be particularly troublesome in a skewed distribution such as Zipf, where an input with high frequency is not mapped to a short codeword it deserves and may not bring much benefit to the block it belongs to. Finally, we remark here that while Huffman code outperform Fibonacci code numerically, it works well only when there are finite alphabets and the distribution is known a priori. Fibonacci code is also advantageous in that it provides robustness against errors and works naturally on the set of integers. In this sense, the multidimensional Fibonacci code could be of particular interest when integers of unknown sign and magnitude are to be encoded.

7. Conclusions

In this paper, we generalize Zeckendorf’s theorem to modules. The notion of equivalent sequences allows us to identify elements that can be represented as a sum of entries from a Fibonacci sequence of order k. This results in the necessary and sufficient conditions for a Fibonacci sequence of higher order to generate a module. In addition, under certain circumstances the representation is unique, allowing us to establish multidimensional Fibonacci coding for modules. Future work involves identifying other conditions to which the representation remains unique. Under such environments, one can view the Zeckendorf representation as a number system and develop a generalized Zeckendorf arithmetic. It would also be interesting to study the proposed coding algorithm from the perspective of data compression and computational complexity.

Author Contributions

Investigation, P.P.; Project administration, W.K.; Supervision, P.U. All authors have read and agreed to the published version of the manuscript.

Funding

This work is supported by the Thailand Research Fund under Grant MRG6180192 and the Centre of Excellence in Mathematics, the Commission on Higher Education, Thailand. P. Pooksombat is supported by the Department of Mathematics and the Faculty of Graduate Studies, Mahidol University.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

The authors wish to thank the anonymous reviewers for their helpful suggestions and comments as well as Eaksit Buathong-iem and Korn Kruaykitanon for their assistance.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Salomon, D. Data Compression the Complete Reference, 3rd ed.; Springer: New York, NY, USA, 2004. [Google Scholar]
  2. Huffman, D. A Method for the Construction of Minimum Redundancy Codes. Proc. IRE 1952, 40, 1098–1101. [Google Scholar] [CrossRef]
  3. de Moura, E.S.; Navarro, G.; Ziviani, N.; Baeza-Yates, R. Fast and Flexible Word Searching on Compressed text. ACM Trans. Inf. Syst. 2000, 18, 113–139. [Google Scholar] [CrossRef]
  4. Brisaboa, N.R.; Iglesias, E.L.; Navarro, G.; Paramá, J.R. An Efficient Compression Code for Text Databases. In Proceedings of the European Conference on IR Research, Pisa, Italy, 14–16 April 2003; pp. 468–481. [Google Scholar]
  5. Anisimov, A.V.; Zavadskyi, I.O. Variable-Length Prefix Codes With Multiple Delimiters. IEEE Trans. Inf. Theory 2017, 63, 2885–2895. [Google Scholar] [CrossRef]
  6. Fraenkel, A.; Klein, S. Robust Universal Complete Codes As Alternatives to Huffman Codes; Technical Report CS85-16; The Weizmann Institute of Science: Rehovot, Israel, 1985. [Google Scholar]
  7. Apostolico, A.; Fraenkel, A. Robust Transmission of Unbounded Strings Using Fibonacci Representations. IEEE Trans. Inf. Theory 1987, 33, 238–245. [Google Scholar] [CrossRef] [Green Version]
  8. Fraenkel, A.; Klein, S. Robust Universal Complete Codes for Transmission and Compression. Discret. Appl. Math. 1996, 64, 31–55. [Google Scholar] [CrossRef] [Green Version]
  9. Matousova, I.; Trojovsky, P. On Coding by (2,q)-Distance Fibonacci Numbers. Mathematics 2020, 8, 2058. [Google Scholar] [CrossRef]
  10. Walder, J.; Kratky, M.; Platos, J. Fast Fibonacci Encoding Algorithm. In Proceedings of the Dateso 2010 Annual International Workshop on DAtabases, TExts, Specifications and Objects, Stedronin-Plazy, Czech Republic, 21–23 April 2010. [Google Scholar]
  11. Walder, J.; Kratky, M.; Baca, R.; Platos, J.; Snasel, V. Fast Decoding Algorithms for Variable-Lengths Codes. Inf. Sci. 2012, 183, 66–91. [Google Scholar] [CrossRef] [Green Version]
  12. Even, S.; Rodeh, M. Economical Encoding of Commas Between Strings. Commun. ACM 1978, 21, 315–317. [Google Scholar] [CrossRef]
  13. Elias, P. Universal Codeword Sets and Representations of the Integers. IEEE Trans. Inf. Theory 1975, 21, 194–203. [Google Scholar] [CrossRef]
  14. Cigler, J. Some Algebraic Aspects of Morse Code Sequences. Discret. Math. Theor. Comput. Sci. 2003, 6, 55–68. [Google Scholar] [CrossRef]
  15. Sato, S. Fibonacci Sequence and its Generalizations Hidden in Algorithms for Generating Morse Codes, Applications of Fibonacci Numbers. In Proceedings of the Fifth International Conference on Fibonacci Numbers and Their Applications, St Andrews, Scotland, 20–24 July 1992; pp. 481–486. [Google Scholar]
  16. Klein, S.T.; Shapira, D. Random Access to Fibonacci Encoded Files. Discret. Appl. Math. 2016, 212, 115–128. [Google Scholar] [CrossRef]
  17. Bellini, E.; Marcolla, C.; Murru, N. An Application of p-Fibonacci Error-Correcting Codes to Cryptography. Mathematics 2021, 9, 789. [Google Scholar] [CrossRef]
  18. Klein, S.T.; Ben-Nissan, M.K. On the Usefulness of Fibonacci Compression Codes. Comput. J. 2009, 53, 701–716. [Google Scholar] [CrossRef] [Green Version]
  19. Bunder, M.W. Zeckendorf Representations Using Negative Fibonacci Numbers. Fibonacci Q. 1992, 30, 111–115. [Google Scholar]
  20. Knuth, D.E. Fibonacci Multiplication. Appl. Math. Lett. 1988, 1, 57–60. [Google Scholar] [CrossRef] [Green Version]
  21. Carlitz, L.; Hoggatt, V.E., Jr.; Scoville, R. Fibonacci Representations of Higher Order. Fibonacci Q. 1972, 10, 43–69. [Google Scholar]
  22. Utgoff, N. A generalization of Zeckendorf’s Theorem. Preprint. Available online: https://people.brandeis.edu/~gessel/47a/2000/papers/utgoff.pdf (accessed on 21 December 2021).
  23. Demontigny, P.; Do, T.; Kulkarni, A.; Miller, S.J.; Moon, D.; Varma, U. Generalizing Zeckendorf’s Theorem to f-decompositions. J. Number Theory 2014, 141, 136–158. [Google Scholar] [CrossRef] [Green Version]
  24. Grabner, P.J.; Tichy, R.F.; Nemes, I.; Pethő, A. Generalized Zeckendorf Expansions. Appl. Math. Lett. 1994, 7, 25–28. [Google Scholar] [CrossRef] [Green Version]
  25. Best, A.; Dynes, P.; Edelsbrunner, X.; McDonald, B.; Miller, S.J.; Turnage-Butterbaugh, C.; Weinstein, M. Gaussian Behavior of the Number of Summands in Zeckendorf Decompositions in Small Intervals. Fibonacci Q. 2014, 52, 47–53. [Google Scholar]
  26. Miller, S.J.; Wang, Y. From Fibonacci Numbers to Central Limit Type Theorems. J. Comb. Theory Ser. A 2012, 119, 1398–1413. [Google Scholar] [CrossRef] [Green Version]
  27. Lekkerkerker, C.G. Voorstelling van natuurlyke getallen door een som van getallen van Fibonacci. Simon Stevin 1952, 29, 190–195. [Google Scholar]
  28. Ben-Ari, I.; Miller, S.J. A Probabilistic Approach to Generalized Zeckendorf Decompositions. SIAM J. Discret. Math. 2016, 30, 1302–1332. [Google Scholar] [CrossRef] [Green Version]
  29. Berzsenyi, G. Gaussian Fibonacci Numbers. Fibonacci Q. 1977, 15, 233–236. [Google Scholar]
  30. Good, I.J. Complex Fibonacci and Lucas Numbers, Continued Fractions, and the Square Root of the Golden Ratio. J. Oper. Res. Soc. 1992, 43, 837–842. [Google Scholar] [CrossRef]
  31. Jordan, J.H. Gaussian Fibonacci and Lucas Numbers. Fibonacci Q. 1965, 3, 315–318. [Google Scholar]
  32. Harman, C.J. Complex Fibonacci Numbers. Fibonacci Q. 1981, 19, 82–86. [Google Scholar]
  33. Halsey, E. The Fibonacci Number Fu where u is not an Integer. Fibonacci Q. 1965, 3, 147–152. [Google Scholar]
  34. Parker, F.D. A Fibonacci function. Fibonacci Q. 1968, 6, 1–2. [Google Scholar]
  35. Miles, E.P., Jr. Generalized Fibonacci Numbers and Associated Matrices. Am. Math. Mon. 1960, 67, 745–757. [Google Scholar] [CrossRef]
  36. Conway, J.; Sloane, N.J.A. Sphere Packings, Lattices and Groups; Springer: Berlin/Heidelberg, Germany, 1988. [Google Scholar]
  37. Yamamoto, H.; Tsuchihashi, M.; Honda, J. Almost Instantaneous Fixed-to-Variable Length Codes. IEEE Trans. Inf. Theory 2015, 61, 6432–6443. [Google Scholar] [CrossRef]
  38. Manning, C.D.; Schütze, H. Foundations of Statistical Natural Language Processing; MIT Press: Cambridge, MA, USA, 1999. [Google Scholar]
Figure 1. The encoded length of a + b i , where 1000 a , b 1000 .
Figure 1. The encoded length of a + b i , where 1000 a , b 1000 .
Mathematics 10 00386 g001
Figure 2. Average codeword length under uniform distribution.
Figure 2. Average codeword length under uniform distribution.
Mathematics 10 00386 g002
Figure 3. Normalized compression ratio under uniform distribution.
Figure 3. Normalized compression ratio under uniform distribution.
Mathematics 10 00386 g003
Figure 4. Average codeword length under Zipf distribution.
Figure 4. Average codeword length under Zipf distribution.
Mathematics 10 00386 g004
Figure 5. Normalized compression ratio under Zipf distribution.
Figure 5. Normalized compression ratio under Zipf distribution.
Mathematics 10 00386 g005
Table 1. Average codeword lengths under Zipf distribution.
Table 1. Average codeword lengths under Zipf distribution.
StringFib3MultiFib3
CodewordLengthCodewordLength
2 2011101118100101118
10 101000111100011114010100010011113
10 20111100011110000001000011113
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Pooksombat, P.; Udomkavanich, P.; Kositwattanarerk, W. Multidimensional Fibonacci Coding. Mathematics 2022, 10, 386. https://0-doi-org.brum.beds.ac.uk/10.3390/math10030386

AMA Style

Pooksombat P, Udomkavanich P, Kositwattanarerk W. Multidimensional Fibonacci Coding. Mathematics. 2022; 10(3):386. https://0-doi-org.brum.beds.ac.uk/10.3390/math10030386

Chicago/Turabian Style

Pooksombat, Perathorn, Patanee Udomkavanich, and Wittawat Kositwattanarerk. 2022. "Multidimensional Fibonacci Coding" Mathematics 10, no. 3: 386. https://0-doi-org.brum.beds.ac.uk/10.3390/math10030386

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop