RosettaCodeData/Task/Four-is-magic/Pluto/four-is-magic.pluto
2026-04-30 12:34:36 -04:00

18 lines
422 B
Text

local fmt = require "fmt"
local function four_is_magic(n)
local s = fmt.spell(n):upper(1)
if n < 0 then s = s:replace("Minus", "Negative") end
local t = s
while n != 4 do
n = #s
s = fmt.spell(n)
t ..= " is " .. s .. ", " .. s
end
return t .. " is magic"
end
for {0, 4, 6, 11, 13, 75, 100, 337, -164, 9007199254740991} as n do
print(four_is_magic(n))
print()
end