I suppose this answer could help you
You need to decide first at what probability you want to "detect" the problem.
This is a nice example to why theoretical knowledge is necessary even for testers.
The simplified version:
p is the probability for failure, 1/N in our case
then the probability for success is 1-p
and the probability to have N successful tries is (1-p)^N
so the probability to have N successful tries and and then a failure would be 1-(1-p)^N
extracting N and simplifying a bit assuming big enough N gives:
−log(1−x1−p)⋅N
(*) "log" is sometimes referred to (for example in calculators) as ln(x), loge(x) or log(x)