RosettaCodeData/Task/Super-d-numbers/Lua/super-d-numbers-3.lua
2026-04-30 12:34:36 -04:00

11 lines
361 B
Lua

bc = require("bc")
for i = 2, 9 do
local d, n, found = bc.new(i), bc.new(0), {}
local dds = string.rep(d:tostring(), d:tonumber())
while #found < 10 do
local dnd = (d * n ^ d):tostring()
if string.find(dnd, dds) then found[#found+1] = n:tostring() end
n = n + 1
end
print("super-" .. d:tostring() .. ": " .. table.concat(found,", "))
end