# 指数哥伦布码

1. 将数字以二进制形式写出(B)，去掉最低的k个位元(D)，之后加1 (A = B + 1)
2. 计算A的比特個数(C)，将此数减一，即是需要增加的前导零个数(Z = C -1)
3. 将第一步中去掉的最低k个比特位补回比特串尾部 (ExpG = Z個0 + A + D)

0阶指数哥伦布码如下所示：

```      Step 1                         Step 2           Step 3
0 => B = 0   ,D = None, A = 1    => C = 1 , Z = 0 => 1
1 => B = 1   ,D = None, A = 10   => C = 2 , Z = 1 => 010
2 => B = 10  ,D = None ,A = 11   => C = 2 , Z = 1 => 011
3 => B = 11  ,D = None ,A = 100  => C = 3 , Z = 2 => 00100
4 => B = 100 ,D = None ,A = 101  => C = 3 , Z = 2 => 00101
5 => B = 101 ,D = None ,A = 110  => C = 3 , Z = 2 => 00110
6 => B = 110 ,D = None ,A = 111  => C = 3 , Z = 2 => 00111
7 => B = 111 ,D = None ,A = 1000 => C = 4 , Z = 3 => 0001000
8 => B = 1000,D = None ,A = 1001 => C = 4 , Z = 3 => 0001001

```

1阶指数哥伦布码如下所示：

```      Step 1                      Step 2           Step 3
0 => B = 0   ,D = 0 , A = 1   => C = 1 , Z = 0 => 10
1 => B = 1   ,D = 1 , A = 1   => C = 1 , Z = 0 => 11
2 => B = 10  ,D = 0 , A = 10  => C = 2 , Z = 1 => 0100
3 => B = 11  ,D = 1 , A = 10  => C = 2 , Z = 1 => 0101
4 => B = 100 ,D = 0 , A = 11  => C = 2 , Z = 1 => 0110
5 => B = 101 ,D = 1 , A = 11  => C = 2 , Z = 1 => 0111
6 => B = 110 ,D = 0 , A = 100 => C = 3 , Z = 2 => 001000
7 => B = 111 ,D = 1 , A = 100 => C = 3 , Z = 2 => 001001
8 => B = 1000,D = 0 , A = 101 => C = 3 , Z = 2 => 001010
```