Sorry if this is felt to be somewhat off-topic as my issue is the math and not the rust code. I'm working through some problems on leetcode. The largest palindrome product problem has me puzzled. The following code is successful and fast:

```
pub fn largest_palindrome(n: i32) -> i32 {
if n == 1 { return 9 }
let min_factor = (10_i32.pow(n as u32 - 1)) as i64;
let max = (10_i32.pow(n as u32)-1) as i64;
let max_factor = (max / 11) * 11;
for i in (min_factor..=max).rev() {
let palindrome = build_palindrome(i, n);
let lower = (palindrome as f64).sqrt().floor() as i64 - ( n as i64 * 121);
let limit = if lower <= 0 { 1 } else { lower };
for j in (limit..=max_factor).rev().step_by(11) {
if palindrome % j == 0 && (palindrome / j) / (max+1) == 0 {
return (palindrome % 1337) as i32
}
}
}
-1
}
fn build_palindrome(i: i64, n: i32) -> i64 {
let mut x = i * 10_i64.pow(n as u32);
let mut y = i;
let mut pal = 0;
while y > 0 {
pal = 10 * pal + y % 10;
y /= 10;
}
pal += x;
pal
}
```

I don't understand why a lower limit of the square root of the palindrome is not low enough to capture all the factors of n digit length. If you iterate from the maximum value to the square root, you cover all the possible factors b/c any factor less than the square root has the corresponding factor greater than the square root. Can someone explain the math for why that is not the case?

Follow up, I do not have a mathematical basis for my "fudge factor" of `n * 121`

other than a vague notion that it should be a multiple of 11 b/c palindrome. I found through trial and error a factor of 44 * (n - 2) also worked, but have no idea why. Any mathematical explanation for finding the true lower limit necessary to cover all factors of n digit length would be appreciated. Thanks.