Not yet working properly problem_26
This commit is contained in:
		
							
								
								
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							@@ -12,4 +12,3 @@ dependencies = [
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "utils"
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
[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);
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user