Given an non-negative integer \$n \ge 0\$, output forever the sequence of integers \$x_i \ge 3\$ that are palindromes in exactly \$n\$ different bases \$b\$, where the base can be \$2 \le b le x_i-2\$.
This is basically the inverse of OEIS A126071, where you output which indices in that sequence have the value \$n\$. It's a bit different, because I changed it so you ignore bases \$b = x_i-1, \: x_i, \: x_i+1\$, since the results for those bases are always the same (the values are always palindromes or always not). Also, the offset is different.
\$x_i\$ is restricted to numbers \$\ge 3\$ so that the first term of the result for each \$n\$ is A037183.
Note that the output format is flexible, but the numbers should be delimited in a nice way.
Examples:
n seq
0 3 4 6 11 19 47 53 79 103 137 139 149 163 167 ...
1 5 7 8 9 12 13 14 22 23 25 29 35 37 39 41 43 49 ...
2 10 15 16 17 18 20 27 30 31 32 33 34 38 44 ...
3 21 24 26 28 42 45 46 50 51 54 55 56 57 64 66 68 70 ...
4 36 40 48 52 63 65 85 88 90 92 98 121 128 132 136 138 ...
5 60 72 78 84 96 104 105 108 112 114 135 140 156 162 164 ...
10 252 400 420 432 510 546 600 648 784 800 810 816 819 828 858 882 910 912 1040 1056 ...
So for \$n=0\$, you get the output of this challenge (starting at \$3\$), because you get numbers that are palindromes in n=0
bases.
For \$n=1\$, \$5\$ is a palindrome in base \$2\$, and that's the only base \$2 \le b \le (5-2)\$ that it's a palindrome in. \$7\$ is a palindrome in base \$2\$, and that's the only base \$2 \le b \le (7-2)\$ that it's a palindrome in. Etc.
Iff your language does not support infinite output, you may take another integer z
as input and output the first z
elements of the sequence, or all elements less than z
. Whichever you prefer. Please state which you used in your answer if this is the case.
n
bases, notn
or more bases? \$\endgroup\$n
is the set of integers>=3
. \$\endgroup\$