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.

A018846 Strobogrammatic numbers: numbers that are the same upside down (using calculator-style numerals).

Original entry on oeis.org

0, 1, 2, 5, 8, 11, 22, 55, 69, 88, 96, 101, 111, 121, 151, 181, 202, 212, 222, 252, 282, 505, 515, 525, 555, 585, 609, 619, 629, 659, 689, 808, 818, 828, 858, 888, 906, 916, 926, 956, 986, 1001, 1111, 1221, 1551, 1691, 1881, 1961, 2002, 2112, 2222, 2552, 2692, 2882
Offset: 1

Views

Author

Keywords

Comments

A018847 lists primes in this sequence. - M. F. Hasler, May 05 2012

Crossrefs

Cf. A053701 (vertically symmetric numbers), A048708.

Programs

  • PARI
    is_A018846(n,t=Vec("012..59.86"))={ apply(x->t[eval(x)+1], n=Vec(Str(n)))==vecextract(n, "-1..1") } \\ M. F. Hasler, May 05 2012
    
  • Python
    from itertools import count, islice, product
    def ud(s): return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')})
    def A018846gen(): # generator of terms
        yield from [0, 1, 2, 5, 8]
        for d in count(2):
            for first in "125689":
                for rest in product("0125689", repeat=d//2-1):
                    left = first + "".join(rest)
                    for mid in [[""], ["0", "1", "2", "5", "8"]][d%2]:
                        yield int(left + mid + ud(left))
    print(list(islice(A018846gen(), 54))) # Michael S. Branicky, Jul 09 2022