Sexy primes: Difference between revisions

m
Rust - reformatted with rustfmt
m (C++ - renamed class)
m (Rust - reformatted with rustfmt)
Line 2,028:
 
for size in 1..max_group_size {
println!("Number of groups of size {} is {}", size + 1, group_count[size]);
"Number of groups of size {} is {}",
size + 1,
group_count[size]
);
println!("Last {} groups of size {}:", groups[size].len(), size + 1);
println!("{}\n", groups[size].asc_iter()
.map(|g| format!("({})\n", to_string(&mut g.iter())))
.collect::<Vec<String>>().join(", "));groups[size]
.asc_iter()
.map(|g| format!("({})", to_string(&mut g.iter())))
.collect::<Vec<String>>()
.join(", ")
);
}
println!("Number of unsexy primes is {}", unsexy_count);
Line 2,040 ⟶ 2,049:
 
fn to_string<T: ToString>(iter: &mut dyn std::iter::Iterator<Item = T>) -> String {
iter.map(|n| n.to_string()).collect::<Vec<String>>().join(", ")
.collect::<Vec<String>>()
.join(", ")
}</lang>
 
1,777

edits