"Asymmetric numeral systems - Comparison of the concept of arithmetic coding (left) and ANS (right). Both can be seen as generalization of standard numeral systems, optimal for uniform probability distribution of digits, into optimized for some chosen probability distribution. Arithmetic or range coding corresponds to adding new information in the most significant position, while ANS generalizes adding information in the least significant position. Its coding rule is ""x goes to x-th appearance of subset of natural numbers corresponding to currently encoded symbol"". In the presented example, sequence (01111) is encoded into a natural number 18, which is smaller than 45 obtained by using standard binary system, due to better agreement with frequencies of sequence to encode. The advantage of ANS is storing information in a single natural number, in contrast to two defining a range."