I have an exam tomorrow on this. My lecturer has put the following in lecture notes: "The number of one- to five-character passwords that can be obtained using elements from a set containing $n > 0$ characters is $N = n + n^2 + n^3 + n^4 + n^5$.".
It was going all fine until the point I was going through past exams yesterday and there was a question(derived from the whole section): calculate the number of possible codes in a $4$ digit pins. Using the above formula it gives me $10+10^2+10^3+10^4 = 11110$. Which is incorrect and the answer should be $10000$.
Now I am extremely lost and my lecturer is not responding to my emails. What scenarios the above formula is usable for? Why does it not work with pins but works for questions like these: "Password characters may be any ASCII characters from $1$ to $127$, inclusive."