Rice Codes represent a nonnegative integer as two parts: a quotient written in unary and a remainder written in a fixed number of binary bits. The parameter tells both sides where that split occurs. This is different from using a unary prefix to describe the binary length of the entire value. Reading a concrete value through division, encoding and reconstruction makes the parameter's role visible.
Let the parameter be k. Divide an unsigned value u by two raised to k, obtaining an integer quotient q and a remainder r. The reconstruction rule is u equals q times two raised to k, plus r. The remainder lies between zero and one less than the divisor, so exactly k binary bits can represent it, including leading zeroes where necessary.
Use a constructed example with u equal to nineteen and k equal to two. The divisor is four, the quotient is four and the remainder is three. The arithmetic check is nineteen equals four times four plus three. Increasing k does not change the value being represented; it changes how much of that value appears in the quotient and how much appears in the remainder.
The convention used here, consistent with the referenced FLAC specification, writes q zero bits followed by a one. Then it appends the k-bit binary remainder. For nineteen with k equal to two, the quotient four becomes 00001 and the remainder three becomes 11. The complete codeword is 0000111, with seven bits.
The stop bit is part of the unary representation, while the remainder has its agreed fixed width. A printed separator between 00001 and 11 is only explanatory punctuation. Another unary polarity would require a correspondingly different decoder; it should not be silently mixed with this example. The figure colors the two parts so their different jobs remain clear.

A decoder counts four zeroes before the first one, giving quotient four. It then reads exactly two further bits because k is two, obtaining remainder three. Recombining them returns nineteen. The quotient does not tell the decoder how many remainder bits to read: that information comes from the shared parameter, typically provided by the surrounding format.
Zero is also a valid unsigned input. With k equal to two, its quotient and remainder are both zero, giving the three-bit codeword 100. With k equal to zero, the remainder occupies no bits and the representation is entirely unary. These boundary cases help distinguish the rule from positive-integer codes that cannot represent zero without an additional mapping.
The code length is q plus one plus k. For nineteen, parameter one gives quotient nine and an eleven-bit codeword. Parameter two uses seven bits. Parameter three gives quotient two and a six-bit codeword; parameter four gives quotient one and also uses six bits. These are arithmetic comparisons for a single synthetic value, not evidence that one parameter is best for an entire data stream.
For a collection containing many small values, a large fixed remainder width may waste bits repeatedly. A very small parameter can instead produce long unary quotients for occasional large values. Choosing a parameter therefore depends on the values being coded and the cost of signaling the choice. Looking only at the largest value does not generally minimize the complete encoded size.

Rice coding in its elementary form accepts nonnegative integers. FLAC uses a folded representation for signed residuals: a nonnegative signed value maps to twice its value, while a negative value maps to minus twice its value minus one. For example, minus three maps to five and positive three maps to six. After Rice decoding, the inverse fold recovers the signed residual.
The fold does not predict the original audio sample and does not itself eliminate information. It assigns nearby nonnegative values to small positive and negative residuals so that an unsigned code can be applied. Prediction, residual formation, signed mapping and Rice representation are different stages. The article's nineteen example is already unsigned and is not presented as an original audio sample.
The FLAC specification describes partitioned Rice parameters and escaped partitions, while the original bitwriter implementation shows how quotient and low bits enter a real output buffer. Our bare codeword omits those surrounding fields. It therefore cannot be compared directly with a complete FLAC frame size or treated as a universal byte serialization.
The site's coding principles collection and technical features provide context for distinguishing a value-level code from an entire compressed format. A useful explanation always states the input domain, parameter, unary polarity and remainder width before interpreting a string of bits.
Primary references: RFC 9639 residual and Rice coding sections and Xiph's original FLAC bitwriter source. Both figures are original AI-assisted diagrams of synthetic integer arithmetic, without compression benchmarks.