For work I have a device that generates a 'random' 8 digit code, with digits ranging from 0-9. The code can start with 0. For example:
01234567
76925951
93508862
I am looking for the probability of generating a code that has:
A) The same digit consecutively at least two times (like 84316635)
B) The same digit consecutively at least three times (like 44468941)
C) The same digit consecutively at least four times (like 23577776)
It doesn't matter if the consecutive digits appear more often than once, or in a longer string than required. It qualifies as soon as it meets the requirements at least once.
These are three separate questions, though obviously related. I can generate some code that gives me the answers, but I'm looking for the calculations without running the experiment. If possible, I'm looking for a single formula to answer all three questions, with variable X being number of consecutive same digits required.