Solve problem 45 using Lua.