drunk <- function(n) { t <- 0:n p <- dbinom(t, n, 1/4) x <- 2*t-n plot(x, p) x[p==max(p)] } drunk(12)