Prime triangle: Difference between revisions
m
Rust - minor edit
(Added Swift solution) |
m (Rust - minor edit) |
||
Line 944:
}
fn prime_triangle_count(a: &mut [u32]
let mut count = 0;
if a.len() == 2 {
if is_prime(a[0] + a[1]) {
}
} else
for i in 1..a.len() - 1 {
}▼
}
}
}
Line 983 ⟶ 985:
for n in 2..21 {
let mut a: Vec<u32> = (1..=n).collect();
}
print!("{}", prime_triangle_count(&mut a));
}
println!();
Line 1,020 ⟶ 1,019:
1 1 1 1 1 2 4 7 24 80 216 648 1304 3392 13808 59448 155464 480728 1588162
Elapsed time:
</pre>
|