23: Fix panix on input `12` for solution for Rust track exercise "Nth Prime".
[?]
Aaw9nJhsNmfzFih9mKyNw9mV8CgERXJkRa1kK1Kx3LQH
Aug 27, 2021, 12:28 PM
KWE5K6XLZULD6MDDVM7X2YFMYMKL76L4MHRAUXZ6EWL5YAJVBKUQCDependencies
- [2]
ERYD4CD711: Add solution for Rust track exercise "Nth Prime". - [3]
JZN2AQ3E10: Add Rust track exercise "nth-prime". - [4]
UTP7D53Q12: Improve solution for Rust track exercise "Nth Prime".
Change contents
- replacement in rust/nth-prime/src/lib.rs at line 6
*/*/ - replacement in rust/nth-prime/src/lib.rs at line 8
// List size approximation is insufficient for values of n = 0, 1, 2, 3, 4, 5, 6, 9 and 11, with the greatest difference of 4 when n = 2, requiring this correction.let corrected_n = if n > 11 { n as f64 } else { (n + 4) as f64 };// List size approximation is insufficient for values of n = 0, 1, 2, 3, 4, 5, 6, 9, 11 and 12, requiring this correction.let corrected_n = (n + match n {0 | 11 => 3,1 | 5 | 6 | 9 => 4,2 | 4 => 6,3 => 5,7 | 8 | 12 => 1,_ => 0,}) as f64; - replacement in rust/nth-prime/src/lib.rs at line 18
let list_size = (corrected_n * (corrected_n * corrected_n.ln()).ln()).ceil() as usize;let list_size = (corrected_n * (corrected_n * corrected_n.ln()).ln()) as usize + 1;