This is a quote from the book "Bitcoin: A Peer-to-Peer Electronic Cash System" by Satoshi Nakamoto
...double AttackerSuccessProbability(double q, int z)
{
double p = 1.0 - q;
double lambda = z * (q / p);
double sum = 1.0;
int i, k;
for (k = 0; k <= z; k++)
/> {
double poisson = exp(-lambda);
for (i = 1; i <= k; i++)
poisson *= lambda / i;
sum -= poisson * (1 - pow(q / p, z - k));
}
return sum;
}
de>

Running some results, we can see the probability drop off exponentially with z.


q=0.1
z=0 P=1.0000000
z=1 P=0.2045873
z=2 P=0.0509779...
read full book block explorer