Given any number let say $N$, how many ways this can be written as the sum of the palindrome numbers. For example $1443$ there are $20$ pairs of palindrome which have sum $1443$. $(1441, 2), (1221, 222), (999, 444), (989, 454), (979, 464), (969, 474), (959, 484), (949, 494), (898, 545), (888, 555), (878, 565), (868, 575), (858, 585), (848, 595), (797, 646), (787, 656), (777, 666), (767, 676), (757, 686) (747, 696)$
I tried this and able to find all possible pairs for small numbers $ N<=10^{14} $.
- list all palindromic numbers in $O(\sqrt N * log N)$.
Iterate through the list for all 1....$\sqrt N$
int id = lowerBound(allPanin, n / 2 + 1); for (int i = 0; i < id; i++) { int p = Collections.binarySearch(allPanin, n - allPanin.get(i)); if (p > 0){ System.out.println(n - allPanin.get(i) + ", " + allPanin.get(i)); tp += 1; } }
But how to find all pairs for $N <= 10^{18}$