This is a Gray code encoder/decoder. The advantage of Gray code is that between each number only one light changes state. The disadvantage of Gray code is that, at least for me, it seems rather hard and confusing to remember which wire has to change state in order for the number to go up or down by one.