-- $Id: ary3.lua,v 1.1 2001/05/31 02:27:48 doug Exp $
-- http://www.bagley.org/~doug/shootout/
-- contributed by Roberto Ierusalimschy

local n = tonumber((arg and arg[1]) or 1)

local x, y = {}, {}

for i=1,n do
  x[i] = i + 1
  y[i] = 0
end
for k=1,1000 do
  for j=n,1,-1 do
    y[j] = y[j] + x[j]
  end
end

io.write(y[1], " ", y[n], "\n")