Let

be a probability assignment on the set of nonnegative integers where

is an arbitrary real number,

. We show that an optimal binary source code for this probability assignment is constructed as follows. Let

be the integer satisfying

and represent each nonnegative integer

as

when

, the integer part of

, and
![r = [i] mod l](/images/tex/5638.gif)
. Encode

by a unary code (i.e.,

zeros followed by a single one), and encode

by a Huffman code, using codewords of length

, for

, and length

otherwise. An optimal code for the nonnegative integers is the concatenation of those two codes.