VikeStep

Finding all the combinations

Oct 6th, 2013
2,802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. local tbl = {"List of Combinations"}
  2.  
  3. local combos = io.open("combos.txt", "w")
  4.  
  5. for a = 0, 65 do
  6.     A = (1.15 ^ a) - 1
  7.     for b = 0, 52 do
  8.         B = A + ((20/3) * ((1.15 ^ b) - 1))
  9.         if (B > 10000) then break end
  10.         for c = 0, 40 do
  11.             C = B + ((100/3) * ((1.15 ^ c) - 1))
  12.             if (C > 10000) then break end
  13.             for d = 0, 28 do
  14.                 -- flush the table here, usually contains ~500 items!
  15.                 if tbl[1] ~= nil then
  16.                     combos:write("\n")
  17.                 end
  18.                 combos:write(table.concat(tbl, "\n"))
  19.                 tbl = {}
  20.                 D = C + ((200) * ((1.15 ^ d) - 1))
  21.                 if (D > 10000) then break end
  22.                 for e = 0, 19 do
  23.                     E = D + ((2000/3) * ((1.15 ^ e) - 1))
  24.                     if (E > 10000) then break end
  25.                     for f = 0, 11 do
  26.                         F = E + ((8000/3) * ((1.15 ^ f) - 1))
  27.                         if (F > 10000) then break end
  28.                         for g = 0, 4 do
  29.                             G = F + ((40000/3) * ((1.15 ^ g) - 1))
  30.                             if G < 10000 and (10000 - G) < (15*(1.15 ^ (a+1)))/100 and (10000 - G) < (100*(1.15 ^ (b+1)))/100 and (10000 - G) < (500*(1.15 ^ (c+1)))/100 and (10000 - G) < (3000*(1.15 ^ (d+1)))/100 and (10000 - G) < (10000*(1.15 ^ (e+1)))/100 and (10000 - G) < (40000*(1.15 ^ (f+1)))/100 and (10000 - G) < (200000*(1.15 ^ (g+1)))/100 then
  31.                                 table.insert(tbl, string.format("%d, %d, %d, %d, %d, %d, %d", a, b, c, d, e, f, g))
  32.                             end
  33.                         end
  34.                     end
  35.                 end
  36.             end
  37.         end
  38.     end
  39. end
  40.  
  41. combos:close()
Advertisement
Add Comment
Please, Sign In to add comment