Since the events are mutually exclusive/independant the you can use a binomial distribution, this is A level maths which I just did the exam for. (Grabbing pencil and paper) This is probably too late for an answer but I can't resist the challenge of rembering maths from an exam I've done twice:
Let X be the number of times he must stop at a red light. The probability of stopping at a red light is 2/8.
Then X is binomially distributed, where the number of events is 8 and the probability of a success is 2/8.
Maths Notation: X ~ B (8, 2/8)
Therefore the probability of (X = 0) = 8C0 x 2/8^0 x 6/8^8
i.e The probability of not hitting a red light to the power of the number of times, multiplied by the number of ways it can happen (8C0 = 1, all the same outcome can only be arranged once way)
The probability of (X < 6) = . Well this is where I look in the formula booklet which would have this probability listed... oddly it's not within an arms reach.
Anyway, to implement this in C I wouldn't be suprised if there was already some code to work with this kind of maths. Alternatively the only thing here which I would have put in a calculator is 8C0 which has it's own formula, something to do with factorials which you can find on the net.
Well that was a whole lotta fun and not a lot of help I suppose.