This function calculates the complexity of a finite binary sequence, according to the work presented by Abraham Lempel and Jacob Ziv in the paper "On the Complexity of Finite Sequences", published in "IEEE Transactions on Information Theory", Vol. IT-22, no. 1, January 1976.
From that perspective, the algorithm could be referred to as "LZ76".
The function supports two methods of evaluating sequence complexity:
1. Decomposition into an exhaustive production process
2. Decomposition into a primitive production process
Exhaustive complexity can be considered a lower limit of the complexity measurement approach proposed in LZ76, and primitive complexity an upper limit.
Currently, only sequences with binary alphabets (0, 1) are supported.
Feel free to email me if you find this function useful, find bugs with it, or have any suggestions for improvements.