OFFSET
1,3
COMMENTS
If n is a term, then so is 10*n.
10^k + 5 is a term for all k >= 4.
10^k + 25 is a term for all k >= 7.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..80
EXAMPLE
a(5) = 25 is a term because the digits of 25^2 = 625 form a subsequence of those of 25^3 = 15625.
a(14) = 10005 is a term because the digits of 10005^2 = 100100025 form a subsequence of those of 10005^3 = 1001500750125.
MAPLE
filter:= proc(n) local L, nL, M, nM, i, j, k;
L:= convert(n^2, base, 10); nL:= nops(L);
M:= convert(n^3, base, 10); nM:= nops(M);
j:= 1:
for i from 1 to nL do
if not member(L[i], M[j..nM], 'k') then return false fi;
j:= j+k;
od;
true
end proc:
select(filter, [$0..5*10^5]);
MATHEMATICA
fQ[n_]:=Module[{len=IntegerLength[n^2], sq=ToString[n^2], qb=ToString[n^3]},
StringMatchQ[qb, StringInsert[sq, "**", Range[1, len+1]]]];
Select[Range[0, 10^6], fQ[#]&] (* Ivan N. Ianakiev, Apr 06 2023 *)
PROG
(Python)
from itertools import count, islice, product
def ok(n):
s, t = n**2, n**3
while s and t:
if t%10 == s%10:
s //= 10
t //= 10
return s == 0
print([k for k in range(10**6+1) if ok(k)]) # Michael S. Branicky, Apr 02 2023
(Python)
from itertools import count, islice
def A362002_gen(startvalue=0): # generator of terms >= startvalue
for k in count(max(startvalue, 0)):
c = iter(str((m:=k**2)*k))
if all(map(lambda b:any(map(lambda a:a==b, c)), str(m))):
yield k
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Apr 02 2023
EXTENSIONS
a(24) and beyond from Michael S. Branicky, Apr 02 2023
STATUS
approved