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).

This page as a plain text file.
%I A018827 #19 Apr 05 2024 08:20:15
%S A018827 0,1,3,7,9,27,32,43,81,131,243,287,706,729,1330,1390,1679,1832,2187,
%T A018827 2899,3848,4170,5234,6436,6561,11544,12510,14261,19308,19683,30433,
%U A018827 33181,34135,35203,35323,37530,38669,42783,59049,72070,79583,93539,99543
%N A018827 Numbers n such that n is a substring of its square in base 3 (written in base 10).
%t A018827 Select[Range[0, 10^5], StringContainsQ[IntegerString[#^2, 3], IntegerString[#, 3]] &] (* _Paolo Xausa_, Apr 05 2024 *)
%o A018827 (Python)
%o A018827 from sympy.ntheory import digits
%o A018827 def s(n, base=3): return "".join(map(str, digits(n, base)[1:]))
%o A018827 def ok(n): return s(n) in s(n**2)
%o A018827 print([k for k in range(10**5) if ok(k)]) # _Michael S. Branicky_, Apr 04 2024
%Y A018827 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).
%K A018827 nonn,base
%O A018827 1,3
%A A018827 _David W. Wilson_