Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A118596
Palindromes in base 5 (written in base 5).
9
0, 1, 2, 3, 4, 11, 22, 33, 44, 101, 111, 121, 131, 141, 202, 212, 222, 232, 242, 303, 313, 323, 333, 343, 404, 414, 424, 434, 444, 1001, 1111, 1221, 1331, 1441, 2002, 2112, 2222, 2332, 2442, 3003, 3113, 3223, 3333, 3443, 4004, 4114, 4224, 4334, 4444, 10001
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
KEYWORD
nonn,base
AUTHOR
Martin Renner, May 08 2006
EXTENSIONS
More terms from Robert G. Wilson v, May 09 2006
STATUS
approved