I believe the right answer is about 2.5% (0.0247)
Here's some imperative scala:
object particle {
def main(args:Array[String]) = {
val simulations = args(0).toInt
val rng = new util.Random
val reachedZero = (1 to simulations).map(_=> {
var t = 0
var z = 1+rng.nextInt(1000)
do {
z += {if (rng.nextBoolean) 1 else -1}
t +=1
} while( z != 0 && t<1000)
z==0
})
println( reachedZero.count(_==true)*1.0d/simulations )
}
}
---
>scala particle 1000000
>0.024782
Some intuition: If there were only 2 positions {1,2}, and you picked 1 with probability 0.5, you could get to 0 by going down once with probability 0.5. Going up wouldn't help since you'd have to go down to be back at 1, at which point you've exhausted your chances. Suppose you picked 2 with probability 0.5, you'd have to go down twice consecutively to hit 0, which has a probability of 0.5^2. So overall, your probability is 0.5^2 + 0.5^3 = 0.375
You can try working it out with 3 positions & 3 turns, and suddenly its not so easy....:)