23: Fix panix on input `12` for solution for Rust track exercise "Nth Prime".

[?]
Aaw9nJhsNmfzFih9mKyNw9mV8CgERXJkRa1kK1Kx3LQH
Aug 27, 2021, 12:28 PM
KWE5K6XLZULD6MDDVM7X2YFMYMKL76L4MHRAUXZ6EWL5YAJVBKUQC

Dependencies

  • [2] ERYD4CD7 11: Add solution for Rust track exercise "Nth Prime".
  • [3] JZN2AQ3E 10: Add Rust track exercise "nth-prime".
  • [4] UTP7D53Q 12: Improve solution for Rust track exercise "Nth Prime".

Change contents

  • replacement in rust/nth-prime/src/lib.rs at line 6
    [2.545][2.545:549]()
    */
    [2.545]
    [3.453]
    */
  • replacement in rust/nth-prime/src/lib.rs at line 8
    [3.481][2.550:783]()
    // 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 };
    [3.481]
    [2.783]
    // 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
    [2.896][2.896:984]()
    let list_size = (corrected_n * (corrected_n * corrected_n.ln()).ln()).ceil() as usize;
    [2.896]
    [2.984]
    let list_size = (corrected_n * (corrected_n * corrected_n.ln()).ln()) as usize + 1;