#!/opt/local/bin/lua -- -- See ../README.md -- -- -- Run as: lua ch-1.lua < input-file -- -- Input will consist of lines; each line will have two numbers, N and k, N > 0, -- k > 0. For each line of input, we output a line with the Nth root of k. -- -- We're not doing any input validations; we're assuming it's correct. -- -- -- To find the Nth root of a number k, we just raise k to the power 1/N -- for line in io . lines () do _, _, N, k = line : find ("(%S+)%s+(%S+)") print (k ^ (1 / N)) end