options(scipen=999)
options(digits=12)
cat("\014") # clear screen
rm(list=ls(all=TRUE))


Prob=function(a,b,k,p) pnbinom(b-k,k,p)-pnbinom(a-k-1,k,p)
Prob(5,5,4,0.7)
Prob(6,8,4,0.7)
Prob(7,10,4,0.7)
Prob(8,12,4,0.7)