// Collected at each stage, like the Louise and Python versions. fn main() { let mut acc: i64 = 0; for k in 1..=10 { let xs: Vec = (1..=1_000_000 + k).collect(); let doubled: Vec = xs.iter().map(|x| x * 2).collect(); let kept: Vec = doubled.into_iter().filter(|x| x % 3 == 0).collect(); acc += kept.iter().sum::(); } println!("{acc}"); }