%I #18 Jun 15 2024 10:19:28
%S 0,1,2,3,4,5,6,7,8,11,22,33,44,55,66,77,88,101,111,121,131,141,151,
%T 161,171,181,202,212,222,232,242,252,262,272,282,303,313,323,333,343,
%U 353,363,373,383,404,414,424,434,444,454,464,474,484,505,515,525,535,545
%N Palindromes in base 9 (written in base 9).
%H Chai Wah Wu, <a href="/A118600/b118600.txt">Table of n, a(n) for n = 1..1457</a>
%t (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 62], Max@IntegerDigits@# < 9 &] (* _Robert G. Wilson v_, May 09 2006 *)
%o (Python)
%o from gmpy2 import digits
%o def palgenbase(l,b): # generator of palindromes in base b <=10 of length <= 2*l, written in base b
%o if l > 0:
%o yield 0
%o for x in range(1,l+1):
%o for y in range(b**(x-1),b**x):
%o s = digits(y,b)
%o yield int(s+s[-2::-1])
%o for y in range(b**(x-1),b**x):
%o s = digits(y,b)
%o yield int(s+s[::-1])
%o A118600_list = list(palgenbase(3,9)) # _Chai Wah Wu_, Dec 01 2014
%o (Python)
%o from sympy import integer_log
%o from gmpy2 import digits
%o def A118600(n):
%o if n == 1: return 0
%o y = 9*(x:=9**integer_log(n>>1,9)[0])
%o return int((s:=digits(n-x,9))+s[-2::-1] if n<x+y else (s:=digits(n-y,9))+s[::-1]) # _Chai Wah Wu_, Jun 14 2024
%Y Cf. A029955, A057148, A118594, A118595, A118596, A118597, A118598, A118599, A118600, A002113.
%K nonn,base
%O 1,3
%A _Martin Renner_, May 08 2006
%E More terms from _Robert G. Wilson v_, May 09 2006