Arithmetic and Boolean Operations on Recursively Run-Length Compressed Natural Numbers

Paul Tarau · Scientific Annals of Computer Science · 2014

We study arithmetic properties of a new tree-based canonical number representation, recursively run-length compressed natural numbers, defined by applying recursively a run-length encoding of their binary digits.We design arithmetic and boolean operations with recursively runlength compressed natural numbers that work a block of digits at a time and are limited only by the representation complexity of their operands, rather than their bitsizes.As a result, operations on very large numbers exhibiting a regular structure become tractable.In addition, we ensure that the average complexity of our operations is still within constant factors of the usual arithmetic operations on binary numbers.Arithmetic operations on our recursively run-length compressed are specified as pattern-directed recursive equations made executable by using a purely declarative subset of the functional language Haskell.

Read the paper · More papers on PaperTik