Find the sum of the first positive integers that are palindromic in base 10 and also in base .
A positive integer is called -mirror if it is a palindrome in both base 10 and base .
Given two integers and , return the sum of the first positive integers that are -mirror numbers.
A number is a palindrome if it reads the same forward and backward in its base representation.
You should consider positive integers only, and the numbers should be counted in increasing order.
Generate the first numbers that satisfy both palindrome conditions, then return their sum.
Example 1
Input
n = 5, k = 2
Output
25
Explanation
The first five positive integers that are palindromic in both base 10 and base 2 are 1, 3, 5, 7, and 9. Their sum is 25.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.