Unary coding: Difference between revisions

Content deleted Content added
More general optimality
Edited for style.
Line 1:
'''Unary coding''' is an [[entropy encoding]] that represents a [[Naturalnatural number]], ''n'', with ''n-1'' − 1 ones followed by a zero. For example 5 is represented as 11110. Some representations use ''n'' ones followed by a zero. Also the use ofThe ones &and zeros are interchangeable without loss of generality.
 
Unary coding is easily shown to be an optimally efficient encoding for the following discrete [[probability distribution]]
Line 9:
:<math>P(n) = (k-1)k^{-n}\,</math>
 
for which <math>''k'' \&ge; \varphi&phi; \approx= 1.618 033 989</math>61803398879&hellip;, the [[golden ratio]], or, more generally, for any distribution for which
 
:<math>P(n) \ge P(n+1) + P(n+2)\, </math>