Coding challenge

Three real numbers $x$, $y$, and $z$ are chosen independently on the interval from $[0,n]$. Write some code that will find the smallest $n$ that will make the probability of 0.5 that: no two of the three numbers are within 1 unit of one another. Use n*math.random() to find a random number from 0 to $n$. (Ans: 10) (Ref: ACM 2012 10A, #25.)

Type your code here:


Lua reference

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code: