login
A362002
Numbers k such that the digits of k^2 are a subsequence of the digits of k^3.
1
0, 1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 10005, 10625, 25000, 50000, 100000, 100005, 100050, 106250, 250000, 500000, 1000000, 1000005, 1000050, 1000500, 1062500, 2500000, 5000000, 10000000, 10000005, 10000025, 10000050, 10000500, 10005000
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
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
A362002_list = list(islice(A362002_gen(), 20)) # Chai Wah Wu, Apr 03 2023
CROSSREFS
Sequence in context: A045620 A025625 A112024 * A245415 A106729 A212950
KEYWORD
nonn,base
AUTHOR
Robert Israel, Apr 02 2023
EXTENSIONS
a(24) and beyond from Michael S. Branicky, Apr 02 2023
STATUS
approved