starting second approach (95, WIP)
This commit is contained in:
@@ -5,6 +5,9 @@ edition = "2021"
|
|||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
itertools = "*"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rstest = "0.17"
|
rstest = "0.17"
|
||||||
|
|
||||||
|
|||||||
+19
-4
@@ -1,8 +1,15 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use itertools::Itertools;
|
||||||
|
|
||||||
const MAX: usize = 1_000_000;
|
const MAX: usize = 1_000_000;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let mut x = build_proper_divisors(3);
|
||||||
|
x.sort();
|
||||||
|
dbg!(x);
|
||||||
|
panic!();
|
||||||
|
|
||||||
let mut chains = vec![];
|
let mut chains = vec![];
|
||||||
|
|
||||||
let mut part_of_any_chain = HashSet::new();
|
let mut part_of_any_chain = HashSet::new();
|
||||||
@@ -23,10 +30,6 @@ fn main() {
|
|||||||
println!("{smallest}");
|
println!("{smallest}");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_proper_divisors(max: usize) -> Vec<Vec<usize>> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn try_build_chain_from_number(
|
fn try_build_chain_from_number(
|
||||||
max: usize,
|
max: usize,
|
||||||
mut current: usize,
|
mut current: usize,
|
||||||
@@ -59,6 +62,18 @@ fn try_build_chain_from_number(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn build_proper_divisors(max: usize) -> Vec<(usize, Vec<usize>)> {
|
||||||
|
// let mut result = vec![];
|
||||||
|
|
||||||
|
let result = (1..max + 1)
|
||||||
|
.combinations(2)
|
||||||
|
.map(|v| (v.clone().into_iter().product(), v))
|
||||||
|
.collect();
|
||||||
|
// result.push(x);
|
||||||
|
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
fn get_proper_divisors(x: usize) -> Vec<usize> {
|
fn get_proper_divisors(x: usize) -> Vec<usize> {
|
||||||
let mut result = vec![1];
|
let mut result = vec![1];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user