MojoでProject Euler 6

https://projecteuler.net/problem=6

べた書きするだけですね。

# e006.mojo
import sys

fn f(N: Int) -> Int:
    var s = 0
    var s2 = 0
    for n in range(1, N+1):
        s += n
        s2 += n*n
    return s*s - s2


fn main() raises:
    let args = sys.argv()
    let N = atol(args[1])
    print(f(N))