working version of sumofprimes in Lua