Sample Space of Longest Run
Aha! Figured it out!

Here is the code I have:

install.packages('gtools')
library(gtools)

x &lt;- c(0, 1) # heads = 0, tails = 1

p = permutations(n = 2, r = 10, v = x, repeats.allowed = T)

p.df = as.data.frame(t(p))

q = apply(p.df, 2, function(x){
max(rle((x == 0))$lengths)
}
)

length(which(q == 10)) #where q == the length of the longest run
```