login
Smallest palindrome k, not less than n, such that k is also a palindrome in base n.
1

%I #17 Nov 18 2019 02:36:10

%S 1,3,4,5,6,7,8,9,191,11,232,181,222,323,828,353,252,171,666,252,22,

%T 161,737,525,494,989,252,232,929,434,1551,33,272,525,252,111,494,585,

%U 5775,656,252,989,44,585,414,141,2112,343,3333,969,676,212,5885,55,616

%N Smallest palindrome k, not less than n, such that k is also a palindrome in base n.

%C a(10^k) = 10^k+1 for k > 0. Conjecture: a(n) in base n has 3 or fewer digits. - _Chai Wah Wu_, Nov 17 2019

%H Chai Wah Wu, <a href="/A329254/b329254.txt">Table of n, a(n) for n = 1..10000</a>

%e For n=9, 191_10 = 232_9.

%t Flatten@{1,Table[k = n; While[! PalindromeQ[k] || k != IntegerReverse[k, n], k++ ]; k, {n, 2, 200}]}

%o (PARI) ispal(k, b) = { my(d=digits(k, b)); d == Vecrev(d);}

%o a(n) = {if (n == 1, return(1)); my(k=n); while (!ispal(k, 10) || ! ispal(k, n), k++); k;} \\ _Michel Marcus_, Nov 18 2019

%Y Cf. A002113 (palindromes in base 10).

%K nonn,base

%O 1,2

%A _Robert Price_, Nov 09 2019