Coding challenge

Suppose you want to solve the equation $x^2-4x-1=0$. So "solve" for $x$ to get $x^2=4x+1$ or $x=4+1/x$. If $x_1=4$ and $x_{n+1}=4+1/x_n$, write some code to show than $x_n$ converges to a root of $x^2-4x-1=0$. (Ref: Engel, p. 186.)

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: