summaryrefslogtreecommitdiffstats
path: root/145-broken.lua
blob: 17138817d0dc5d2c7bc029a4a8402b8040070e5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
-- this will take ~6h to run... need efficiency!
function reversible(n)
    local revn = n:reverse()
    local str = tostring(n + revn)
    return not str:match("[02468]")
end

local sum = 0
for i = 1, 999999999 do
    if i % 10 ~= 0 and reversible(tostring(i)) then sum = sum + 1 end
end
print(sum)