Solve problem 27 using Lua.