use crate::Solution;
use pmath::phi_0_to_n;
problem!(Problem0069, 69, "Totient Maximum");
impl Solution for Problem0069 {
fn solve(&self) -> String {
const MAX_N: u64 = 1_000_000; let phi_values = phi_0_to_n(MAX_N);
let mut max_ratio = 0.0;
let mut max_index = 0;
for n in 1..=MAX_N {
let ratio = n as f64 / phi_values[n as usize] as f64;
if ratio > max_ratio {
max_ratio = ratio;
max_index = n;
}
}
max_index.to_string()
}
}