
The Riddler of this week had a quick riddle: if one does want to avoid parallel parking a car over a six spot street, either the first spot is available or two consecutive spots are free. What is the probability this happens with 4 other cars already parked (at random)?
While a derivation by combinatorics easily returns 9/15 as the probability to fail to park, a straightforward R code does as well
l=0
for(t in 1:1e6){
k=sort(sample(0:5,4))
l=l+1*(!!k[1]|3%in%diff(k)|!k[4]%%3)}
since
> round(choose(6,2)*F/1e6) [1] 10
