44 lines
1.2 KiB
Text
44 lines
1.2 KiB
Text
local rgs = {
|
|
{2, 1000, true},
|
|
{1000, 4000, true},
|
|
{2, 1e4, false},
|
|
{2, 1e5, false},
|
|
{2, 1e6, false},
|
|
{2, 1e7, false},
|
|
{2, 1e8, false},
|
|
{2, 1e9, false}
|
|
}
|
|
|
|
for rgs as rg do
|
|
if rg[1] == 2 then
|
|
print($"eban numbers up to and including {math.round(rg[2])}")
|
|
else
|
|
print($"eban numbers between {rg[1]} and {rg[2]} (inclusive):")
|
|
end
|
|
local count = 0
|
|
local i = rg[1]
|
|
while i <= rg[2] do
|
|
local b = i // 1e9
|
|
local r = i % 1e9
|
|
local m = r // 1e6
|
|
r = i % 1e6
|
|
local t = r // 1000
|
|
r = r % 1000
|
|
if 30 <= m <= 66 then m %= 10 end
|
|
if 30 <= t <= 66 then t %= 10 end
|
|
if 30 <= r <= 66 then r %= 10 end
|
|
if b == 0 or b == 2 or b == 4 or b == 6 then
|
|
if m == 0 or m == 2 or m == 4 or m == 6 then
|
|
if t == 0 or t == 2 or t == 4 or t == 6 then
|
|
if r == 0 or r == 2 or r == 4 or r == 6 then
|
|
if rg[3] then io.write($"{i} ") end
|
|
count += 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
i += 2
|
|
end
|
|
if rg[3] then print() end
|
|
print($"count = {count}\n")
|
|
end
|