Rust Implementation of Problem 3
View source code here on GitHub!
Includes
Problem Solution
- pub fn problems::p0003::p0003() -> utils::Answer
1/*
2Project Euler Problem 3
3
4This problem was fun, because it let me learn how to make Iterators in rust
5
6Problem:
7
8The prime factors of 13195 are 5, 7, 13 and 29.
9
10What is the largest prime factor of the number 600851475143 ?
11*/
12use crate::include::primes::prime_factors;
13use crate::include::utils::Answer;
14
15pub fn p0003() -> Answer {
16 return Answer::Int(
17 prime_factors::<u64>(600851475143)
18 .max()
19 .expect("This number has prime factors")
20 .into()
21 );
22}