cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A253147 Palindromes in base 10 >= 256 that remain palindromes when the digits are reversed in base 256.

Original entry on oeis.org

8448, 31613, 32123, 55255, 63736, 92929, 96769, 108801, 450054, 516615, 995599, 1413141, 1432341, 1539351, 1558551, 2019102, 2491942, 2513152, 2712172, 2731372, 2750572, 2807082, 2838382, 2857582, 2876782, 3097903, 3740473, 3866683, 3885883, 4201024, 4220224, 4327234
Offset: 1

Views

Author

Chai Wah Wu, Dec 29 2014

Keywords

Comments

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.

Examples

			2857582 is in the sequence since 2857582 is 2b 9a 6e in base 16 and 6e 9a 2b = 7248427 is a palindrome.
		

Crossrefs

Programs

  • Python
    def palgen(l, b=10): # generator of palindromes in base b of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1, l+1):
                n = b**(x-1)
                n2 = n*b
                for y in range(n, n2):
                    k, m = y//b, 0
                    while k >= b:
                        k, r = divmod(k, b)
                        m = b*m + r
                    yield y*n + b*m + k
                for y in range(n, n2):
                    k, m = y, 0
                    while k >= b:
                        k, r = divmod(k, b)
                        m = b*m + r
                    yield y*n2 + b*m + k
    def reversedigits(n, b=10): # reverse digits of n in base b
        x, y = n, 0
        while x >= b:
            x, r = divmod(x, b)
            y = b*y + r
        return b*y + x
    A253147_list = []
    for n in palgen(4):
        x = reversedigits(n, 256)
        if n > 255 and x == reversedigits(x, 10):
            A253147_list.append(n)