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.

A253148 Nontrivial palindromes in base 10 and base 256.

Original entry on oeis.org

55255, 63736, 92929, 96769, 108801, 450054, 516615, 995599, 1413141, 1432341, 1539351, 1558551, 2019102, 2491942, 2807082, 3097903, 3740473, 3866683, 3885883, 4201024, 4220224, 4327234, 4346434, 4365634, 4384834, 5614165, 5633365, 5759575, 6692966, 7153517, 7172717
Offset: 1

Views

Author

Chai Wah Wu, Dec 30 2014

Keywords

Comments

Palindromes in base 256 are numbers that are the same in big-endian and little-endian order with 8-bit words. See also A238853.
A palindromic number in base 10 which is below 256 is a 1-digit number in base 256. Thus, it is automatically a palindrome in base 256. This sequence excludes 1-digit numbers in base 256. - Tanya Khovanova, Aug 21 2021

Examples

			7172717 in base 16 is 6d 72 6d and the bytes form a palindrome.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[256, 10000000], PalindromeQ[#] && PalindromeQ[IntegerDigits[#, 256]] &] (* Tanya Khovanova, Aug 21 2021 *)
  • Python
    from _future_ import division
    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
    A253148_list = []
    for n in palgen(5):
        if n > 255 and n == reversedigits(n,256):
            A253148_list.append(n)

Extensions

Name clarified by Tanya Khovanova, Aug 21 2021