re: Project Euler #6 - Sum Square Difference VIEW POST

FULL DISCUSSION
 

Rust Solution: Playground

fn main() {
    println!("{}", get_difference(100));
}

fn get_difference(end: usize) -> u32 {
    ((1..=end).sum::<usize>().pow(2) - (1..=end).map(|n| n.pow(2)).sum::<usize>()) as u32
}
code of conduct - report abuse