login
A018827
Numbers n such that n is a substring of its square in base 3 (written in base 10).
8
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,3
MATHEMATICA
Select[Range[0, 10^5], StringContainsQ[IntegerString[#^2, 3], IntegerString[#, 3]] &] (* Paolo Xausa, Apr 05 2024 *)
PROG
(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
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).
Sequence in context: A098338 A033958 A352016 * A249664 A057840 A339614
KEYWORD
nonn,base
STATUS
approved