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.

A018827 Numbers n such that n is a substring of its square in base 3 (written in base 10).

Original entry on oeis.org

0, 1, 3, 7, 9, 27, 32, 43, 81, 131, 243, 287, 706, 729, 1330, 1390, 1679, 1832, 2187, 2899, 3848, 4170, 5234, 6436, 6561, 11544, 12510, 14261, 19308, 19683, 30433, 33181, 34135, 35203, 35323, 37530, 38669, 42783, 59049, 72070, 79583, 93539, 99543
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A018826 (base 2), A018828 (base 4), A018829 (base 5), A018830 (base 6), A018831 (base 7), A018832 (base 8), A018833 (base 9), A018834 (base 10).

Programs

  • Mathematica
    Select[Range[0, 10^5], StringContainsQ[IntegerString[#^2, 3], IntegerString[#, 3]] &] (* Paolo Xausa, Apr 05 2024 *)
  • Python
    from sympy.ntheory import digits
    def s(n, base=3): return "".join(map(str, digits(n, base)[1:]))
    def ok(n): return s(n) in s(n**2)
    print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Apr 04 2024