SHARE
TWEET

BruteForce

a guest May 30th, 2015 88,321 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local UpsideDownData = {
  2.    [0] = 0,
  3.    [1] = 1,
  4.    [2] = 2,
  5.    [5] = 5,
  6.    [6] = 9,
  7.    [8] = 8,
  8.    [9] = 6
  9. }
  10.  
  11. local Numbers = {}
  12.  
  13. function Test(str)
  14.    local digits = {}
  15.    for i = 1,#str do
  16.       if not digits[str:sub(i, i)] then
  17.          digits[str:sub(i, i)] = true
  18.       else
  19.          return false
  20.       end
  21.    end
  22.    if digits["3"] or digits["4"] or digits["7"] then
  23.       return false
  24.    end
  25.    return true
  26. end
  27.  
  28. function TestUpsideDown(n, nn)
  29.    local nt = {}
  30.    for i = 5, 1, -1 do
  31.       table.insert(nt, #nt+1, tonumber(n:sub(i, i)))
  32.    end
  33.    for i = 1,5 do
  34.       if UpsideDownData[nt[i]] ~= tonumber(nn:sub(i, i)) then
  35.          return false
  36.       end
  37.    end
  38.    return true
  39. end
  40.  
  41. for i = 10234,21365 do
  42.    local x = tostring(i)
  43.    local xx = tostring(i+78633)
  44.    if Test(x) and Test(xx) then
  45.       if TestUpsideDown(x, xx) then
  46.          print(x, xx)
  47.       end
  48.    end
  49. end
  50.  
  51. print("Done")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top