I'm working on a problem involving recency rank encoding in which I must find some probabilities that I'm having issues calculating.

Given a source alphabet with zeroth order relative frequencies , I need to find the probabilities where is the probability that between the occurence of a particular source letter and the previous occurence of that same source letter, there are i different source letters (i.e. the last in the source texts and would be encoded with a codeword in both cases since there are only two *different* source letters between the occurences of ). I am trying to find formulas for each of these , especially . Could anyone give me some tips on how to find these probabilities?