OFFSET
1,3
MATHEMATICA
(* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 109], Max@IntegerDigits@# < 7 &] (* Robert G. Wilson v, May 09 2006 *)
PROG
(Python)
from sympy import integer_log
from gmpy2 import digits
def A118598(n):
if n == 1: return 0
y = 7*(x:=7**integer_log(n>>1, 7)[0])
return int((s:=digits(n-x, 7))+s[-2::-1] if n<x+y else (s:=digits(n-y, 7))+s[::-1]) # Chai Wah Wu, Jun 14 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Martin Renner, May 08 2006
EXTENSIONS
Corrected and extended by Robert G. Wilson v, May 09 2006
STATUS
approved