// rustc squares.rs -o squares
// rustc squares.rs -o squares_O3 -C opt-level=3
fn main()
{
let sequence = 0..1000000;
let squares = sequence.map( | x | {let result = x*x;
result
});
let mut sum:u64 = 0;
for n in squares
{
sum = sum + n
}
println!("{}", sum);
}