%I #13 Nov 02 2024 16:02:29
%S 8448,31613,32123,55255,63736,92929,96769,108801,450054,516615,995599,
%T 1413141,1432341,1539351,1558551,2019102,2491942,2513152,2712172,
%U 2731372,2750572,2807082,2838382,2857582,2876782,3097903,3740473,3866683,3885883,4201024,4220224,4327234
%N Palindromes in base 10 >= 256 that remain palindromes when the digits are reversed in base 256.
%C Reversing the digits in base 256 is equivalent to reading a number in big-endian format using little-endian order with 8-bit words. See also A238853.
%H Chai Wah Wu, <a href="/A253147/b253147.txt">Table of n, a(n) for n = 1..176</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Endianness">Endianness</a>
%e 2857582 is in the sequence since 2857582 is 2b 9a 6e in base 16 and 6e 9a 2b = 7248427 is a palindrome.
%o (Python)
%o def palgen(l, b=10): # generator of palindromes in base b of length <= 2*l
%o if l > 0:
%o yield 0
%o for x in range(1, l+1):
%o n = b**(x-1)
%o n2 = n*b
%o for y in range(n, n2):
%o k, m = y//b, 0
%o while k >= b:
%o k, r = divmod(k, b)
%o m = b*m + r
%o yield y*n + b*m + k
%o for y in range(n, n2):
%o k, m = y, 0
%o while k >= b:
%o k, r = divmod(k, b)
%o m = b*m + r
%o yield y*n2 + b*m + k
%o def reversedigits(n, b=10): # reverse digits of n in base b
%o x, y = n, 0
%o while x >= b:
%o x, r = divmod(x, b)
%o y = b*y + r
%o return b*y + x
%o A253147_list = []
%o for n in palgen(4):
%o x = reversedigits(n, 256)
%o if n > 255 and x == reversedigits(x, 10):
%o A253147_list.append(n)
%Y Cf. A253148, A253149, A238853.
%K nonn,base,changed
%O 1,1
%A _Chai Wah Wu_, Dec 29 2014