Guest User

A bit of Lua golf

a guest
Aug 6th, 2017
41
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- original
  2. x=tonumber(io.read())or 2 y=tonumber(io.read())or 2 if y^(x%5)+x*y+y~=x^3-(x-120)*x then while 1 do end end
  3.  
  4. -- golfing...
  5. n=tonumber x=n(io.read())or 2 y=n(io.read())or 2 if y^(x%5)+x*y+y~=x^3-(x-120)*x then while 1 do end end
  6.  
  7. n=tonumber x=n(io.read())or 2 y=n(io.read())or 2 if y^(x%5)+x*y+y~=x^3-(x-120)*x then while""do end end
  8.  
  9. n=tonumber r=io.read x=n(r())or 2 y=n(r())or 2 if y^(x%5)+x*y+y~=x^3-(x-120)*x then while""do end end
  10.  
  11. n=tonumber r=io.read x=n(r())or 2 y=n(r())or 2 if y^(x%5)+x*y+y~=x^3-x*(x-120)then while""do end end
  12.  
  13. -- The Lua 5.3 parser (as seen on try-it-online) doesn't always need a space between numbers and the next
  14. -- token. (If the following letter is a hex digit, it won't work.)
  15. -- I think this also works in Lua 5.2, but not Lua 5.1.
  16.  
  17. n=tonumber r=io.read x=n(r())or 2y=n(r())or 2if y^(x%5)+x*y+y~=x^3-x*(x-120)then while""do end end
  18.  
  19. n=tonumber r=io.read x=n(r())or 2y=n(r())or 2while y^(x%5)+x*y+y~=x^3-x*(x-120)do end
  20.  
  21. -- Using ... is often the golfiest way to get input, but it reads arguments rather than stdin
  22. -- ie, not strictly equivalent
  23.  
  24. x,y=...n=tonumber x=n(x)or 2y=n(y)or 2while y^(x%5)+x*y+y~=x^3-x*(x-120)do end
  25.  
  26. x,y=...n=tonumber x=n(x)or 2y=n(y)or 2while y^(x%5)+y~=x^3-x*(x-120+y)do end
  27.  
  28. x,y=...n=tonumber x=n(x)or 2y=n(y)or 2while(x-120+y)*x+y~=x^3-y^(x%5)do end
RAW Paste Data