<<Up     Contents

Elias Delta coding

Elias Delta code is a universal code[?] encoding the positive integers. To code a number:
  1. Write it in binary.
  2. Count the bits, remove the leading one, and write that number in binary preceding the previous bit string.
  3. Subtract 1 from the number of bits written in step 2 and prepend that many zeros.
The code begins:
  1 1
  2 0100
  3 0101
  4 01100
  5 01101
  6 01110
  7 01111
  8 00100000
  9 00100001
 10 00100010
 11 00100011
 12 00100100
 13 00100101
 14 00100110
 15 00100111
 16 001010000
 17 001010001

See also Elias Gamma coding

wikipedia.org dumped 2003-03-17 with terodump