Q:

Kraft Macmillan inequality explanation

I am going through some questions and answers regarding Information Theory and I found this question and its solution. Can some one explain this solution to me.
We would like to encode a sequence of symbols that come from an alphabet with d+3 symbols. We want to encode symbols  a_1,a_2,and a_3 using code words that are three bits long and symbols a_4,a_5,…,a_(d+1) with code words that are eight bits long. What is the maximum value of d for which this will be possible, if the code must be uniquely decidable?
and the answer is:
The codeword lengths are possible if and only if they satisfy the Kraft-MacMillan inequality,which in this case is 
1/2^3 +1/2^3 +1/2^3 +d/2^8 <= 1 
This is equivalent to 
d/256<=5/8
which is equivalent to d<=160. The maximum value possible value of d is therefore 160.
what is the function d+3 , and where we used it . How 5/8 appears in equation.
What is the effect of d+3 symbols on all this scenario. If I change it to d+1, what is the effect of it

A:

I think it's just in the first inequality (the Kraft inequality): you sum over all the symbols $1/2^{\text{length of encoding}}$. There are 3 symbols of length $3$ bits and $d$ symbols of length $8$ bits, so that's how you get the first inequality. (Also, does your question have a typo? $a_4,a_5,\dots,a_{d+3}$ rather than $\dots,a_{d+1}$.) The $5/8$ comes from simplifying the inequality: you get $3/8 + d/256 \leq 1$, which is equivalent to $d/256 \leq 5/8$.

