We put together a problem to be solved programmatically, and we know at lower numbers there is a solution to this problem. How would we go about proving whether the below problem has an answer, as our standard computational approaches do not yield a value.
$X$ is the sum of the first $N$ palindromes. Find the value for $N$ in which $X$ is both over $3$ million and is in it's self palindromic.
We used JS to create a function which finds lower values, but the integers are too large to find a solution where x is greater than 3m
function isPalindrome(x) {
const s = `${x}`;
for (let i = 0; i < (s.length - 1) / 2; i++) {
if (s[i] !== s[s.length - i - 1]) return false
}
return true
}
function quickExhaustiveSearch(limit) {
let i = 0,
n = 0, // number of pals
x = 0; // sum of N first pal
console.log(`Solving for x>${limit} starting at i=${i} and n=${n}`);
while (x < limit || !isPalindrome(x)) {
if (isPalindrome(i)) {
x += i;
n++;
console.log({x, i, n});
}
i++
}
console.log('Solution is', x, i, n);
}