Coding challenge

Write some code that sums the first $1000$ consecutive integers. Show your result equals $S_n=\frac{1}{2}n(a_1+a_n)$, for $n=1000$ ($a_1=1$ and $a_{1000}=1000$). Does this hold for other values of $n$? Say, the first 100 integers?

Type your code here:


Lua reference

See your results here: