YGJVWTKAANDS6TUXWRI5V4TLVWTZNBNX2HXRYJ2WSPBPI2U6MB2AC
XDEY7SNLZMAC3KIKUHDGZGGXHHT7BYF3GSVAREXESO5D4S6FZBQQC
VH5OFL554R47JLRPRPJK4BPVNEREVXQ7E6F42KN7ADEELB7VGYOAC
ERYD4CD76UGRWQJXSVEPME4XJNQOGECALQEB3NBE76RLJX22TX6AC
IXMBS6ZPQSFG6HTYGHNJJ3YK2KYGUBBNTMIU7Q5CAKLJEXSBP4EAC
JZN2AQ3EMSXVYKPYPMHKN6JFKAFGZMQLHO7N5A37SKTNFWFI53OQC
KWE5K6XLZULD6MDDVM7X2YFMYMKL76L4MHRAUXZ6EWL5YAJVBKUQC
UTP7D53QIV7KUBI3DX36GSDXMSAVIMDSPOSYN7SJEREOHBHJIEKAC
// Approximated size of the list required using the inverse of an approximation of the prime-counting function.
let list_size = (corrected_n * (corrected_n * corrected_n.ln()).ln()) as usize + 1;
// Approximated size of the list required using the inverse of an approximation of the prime-counting function, halved (as we're only interested in odd numbers).
let list_size = (corrected_n * (corrected_n * corrected_n.ln()).ln() / 2.0) as usize + 1;
if limit & 1 == 1 {
for index in (limit..list_size).step_by(2) {
if list[index] {
count += 1;
if count > n {
// Might panic if values greater than u32::MAX are cast.
return index as u32;
}
}
}
} else {
if list[limit] {
for index in limit..list_size {
if list[index] {
for index in ((limit + 1)..list_size).step_by(2) {
if list[index] {
count += 1;
if count > n {
// Might panic if values greater than u32::MAX are cast.
return index as u32;
}
}
}