Solve problem 50 using Lua.