OFFSET
1,3
COMMENTS
Equivalently, palindromes k (written in base 10) such that 2*k is a palindrome. - Bruno Berselli, Sep 12 2018
MATHEMATICA
(* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 198], Max@IntegerDigits@# < 5 &] (* Robert G. Wilson v, May 09 2006 *)
Select[FromDigits/@IntegerDigits[Range[1000], 5], PalindromeQ] (* Fred Patrick Doty, Aug 12 2017 *)
PROG
(PARI) is(n)=if(n<5, return(n>=0)); my(d=digits(n)); vecmax(d)<5 && Vecrev(d)==d \\ Charles R Greathouse IV, Aug 22 2017
(Python)
from sympy import integer_log
from gmpy2 import digits
def A118596(n):
if n == 1: return 0
y = 5*(x:=5**integer_log(n>>1, 5)[0])
return int((s:=digits(n-x, 5))+s[-2::-1] if n<x+y else (s:=digits(n-y, 5))+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