Is there an alternative encoding scheme to binary where similarity of pattern correlates with size of number?

790 Views Asked by At

If I compare binary for 7

111

and binary for 8

1000

there is no correlation between these two patterns that suggests that the numbers are sequentially close to each other.

Is there a recognized, efficient encoding scheme using 1s and 0s for base ten numbers in which the more similar two patterns are, the closer the base ten numbers are?

Of course you could just have

1 -> 1
2 -> 11
3 -> 111
4 -> 1111

etc, but there must be more compact ways to do it!