It is a particular case of the Huffman code where the number of bits of each
code-word (minus one) is equal to the index of the symbol in the source
alphabet. Example:
Code
0
0
1
10
2
110
3
1110
4
11110
5
111110
6
1111110
7
11111110
8
111111110
The unary coding is only optimal when (see Equation ??)