Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Palindromes in base 5 (written in base 5).
9

%I #28 Jun 15 2024 02:10:28

%S 0,1,2,3,4,11,22,33,44,101,111,121,131,141,202,212,222,232,242,303,

%T 313,323,333,343,404,414,424,434,444,1001,1111,1221,1331,1441,2002,

%U 2112,2222,2332,2442,3003,3113,3223,3333,3443,4004,4114,4224,4334,4444,10001

%N Palindromes in base 5 (written in base 5).

%C Equivalently, palindromes k (written in base 10) such that 2*k is a palindrome. - _Bruno Berselli_, Sep 12 2018

%t (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 198], Max@IntegerDigits@# < 5 &] (* _Robert G. Wilson v_, May 09 2006 *)

%t Select[FromDigits/@IntegerDigits[Range[1000],5],PalindromeQ] (* _Fred Patrick Doty_, Aug 12 2017 *)

%o (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

%o (Python)

%o from sympy import integer_log

%o from gmpy2 import digits

%o def A118596(n):

%o if n == 1: return 0

%o y = 5*(x:=5**integer_log(n>>1,5)[0])

%o 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

%Y Cf. A029952, 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