I am working on compression algorithm for which I want to replace all consecutive number with its mathematical