Elias delta coding

Elias δ code or Elias delta code is a universal code encoding the positive integers developed by Peter Elias.

[1]: 200 To code a number X ≥ 1: An equivalent way to express the same process: To represent a number

, Elias delta (δ) uses

[1]: 200 This is useful for very large integers, where the overall encoded representation's bits end up being fewer [than what one might obtain using Elias gamma coding] due to the

: To decode an Elias delta-coded integer: Example: This code can be generalized to zero or negative integers in the same ways described in Elias gamma coding.

One way to code all non negative integers is to add 1 before coding and then subtract 1 after decoding.

This bijection can be performed using the "ZigZag" encoding from Protocol Buffers (not to be confused with Zigzag code, nor the JPEG Zig-zag entropy coding).