I was solving a question where I had to find the number of numbers of length N without having any consecutive zeros from the set [0,K-1] for any K.
I came up with the following equation using exclusion principle:-
$ count(N,K)=K^N - \sum _{i=2}^N\:K^{\left(N-i\right)}\left(N+1-i\right)$
My question : Is the equation correct and does the series converge to a single value if N = $\inf$ ?
EDIT:
I am subtracting all ways in which consecutive 0s can occur. For eg for 2 consecutive 0s, I bunch the two 0s up as 1. Now, I have N-1 remaining places from which I select 1 place in (N-1) ways. The remaining N-2 places (after un-bunching up the two 0s) have $\left(N-2\right)^{K-1}$ choices ( excluding zero and also repetition of other digits is allowed)
I repeat the process for 3 consecutive 0s, 4 consecutive 0s up to N consecutive 0s.
i is the number of consecutive 0s