OFFSET
1,3
COMMENTS
2*a(n) and 3*a(n) give palindromes in base 10 for any n. - Arkadiusz Wesolowski, Jun 22 2012
Equivalently, palindromes k (written in base 10) such that 3*k is a palindrome. - Bruno Berselli, Sep 12 2018
MATHEMATICA
(* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 290], Max@IntegerDigits@# < 4 &] (* Robert G. Wilson v, May 09 2006 *)
PROG
(Python)
from gmpy2 import digits
def A118595(n):
if n == 1: return 0
y = (x:=1<<(n.bit_length()-2&-2))<<2
return int((s:=digits(n-x, 4))+s[-2::-1] if n<x+y else (s:=digits(n-y, 4))+s[::-1]) # Chai Wah Wu, Jun 14 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Martin Renner, May 08 2006
EXTENSIONS
More terms from Robert G. Wilson v, May 09 2006
STATUS
approved