Not yet working properly problem_26
This commit is contained in:
parent
0ea936e89f
commit
5f1b765922
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -12,4 +12,3 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "utils"
|
name = "utils"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.plobos.xyz/projects/PuzzleUtils.git#d3a93a875f56c8f865411c0b7437986f413ca524"
|
|
||||||
|
@ -6,4 +6,5 @@ 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]
|
[dependencies]
|
||||||
utils = { git = "https://git.plobos.xyz/projects/PuzzleUtils.git" }
|
#utils = { git = "https://git.plobos.xyz/projects/PuzzleUtils.git" }
|
||||||
|
utils = { path = "/home/fabian/Git/utils/" }
|
||||||
|
19
src/bin/problem_26.rs
Normal file
19
src/bin/problem_26.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
use utils::fraction::Fraction;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Start");
|
||||||
|
let mut longest = (0, 0);
|
||||||
|
for denominator in 7..13 {
|
||||||
|
println!("1/{denominator}:");
|
||||||
|
let f = Fraction {
|
||||||
|
numerator: 1.into(),
|
||||||
|
denominator: denominator.into(),
|
||||||
|
};
|
||||||
|
let rep = f.get_repeating();
|
||||||
|
if longest.1 < rep.digits.len() {
|
||||||
|
longest = (denominator, rep.digits.len());
|
||||||
|
}
|
||||||
|
println!("{rep}");
|
||||||
|
}
|
||||||
|
println!("longest {}", longest.0);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user