Coding challenge

Write some code that chooses x=math.random() and finds the probability that the fractional part of $1/x$ (the part to the right of the decimal only) is greater than x? What is the average value of the fractional part of $1/x$? (Ref:

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: