lets say you’re trying to encode a number, eg. n = 1000, the number of digits needed to encode it in an arbitrary base b is log(n)/log(b) (the base b logarithm of n)
The amount of space necessary to encode that number given that base is b * number of digits
Therefore, the amount of space to encode a given number of an arbitrary base is b * log(n)/log(b), and since log(n) is a constant, you can sort of pretend it doesn’t exist
So if you minimize b / log(b), you get b = e. But you can’t really have non-integer bases.
However, b/log(3) < b/log(2) so ternary is more efficient because it’s closer to e