diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-05-13 23:32:40 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-05-13 23:32:40 -0500 |
commit | 7e7b56db42ceb8d2b8973eae678fa4b58d5d3659 (patch) | |
tree | 7a5cb816809d632e30227c1e39485ed63b500e80 /145.lua | |
download | projecteuler-7e7b56db42ceb8d2b8973eae678fa4b58d5d3659.tar.gz projecteuler-7e7b56db42ceb8d2b8973eae678fa4b58d5d3659.zip |
add old solutions
Diffstat (limited to '145.lua')
-rw-r--r-- | 145.lua | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -0,0 +1,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) |