login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers k such that the digits of k^2 are a subsequence of the digits of k^3.
1

%I #28 Apr 23 2023 23:32:17

%S 0,1,5,10,25,50,100,250,500,1000,2500,5000,10000,10005,10625,25000,

%T 50000,100000,100005,100050,106250,250000,500000,1000000,1000005,

%U 1000050,1000500,1062500,2500000,5000000,10000000,10000005,10000025,10000050,10000500,10005000

%N Numbers k such that the digits of k^2 are a subsequence of the digits of k^3.

%C If n is a term, then so is 10*n.

%C 10^k + 5 is a term for all k >= 4.

%C 10^k + 25 is a term for all k >= 7.

%H Chai Wah Wu, <a href="/A362002/b362002.txt">Table of n, a(n) for n = 1..80</a>

%e a(5) = 25 is a term because the digits of 25^2 = 625 form a subsequence of those of 25^3 = 15625.

%e a(14) = 10005 is a term because the digits of 10005^2 = 100100025 form a subsequence of those of 10005^3 = 1001500750125.

%p filter:= proc(n) local L,nL,M,nM,i,j,k;

%p L:= convert(n^2,base,10); nL:= nops(L);

%p M:= convert(n^3,base,10); nM:= nops(M);

%p j:= 1:

%p for i from 1 to nL do

%p if not member(L[i],M[j..nM],'k') then return false fi;

%p j:= j+k;

%p od;

%p true

%p end proc:

%p select(filter, [$0..5*10^5]);

%t fQ[n_]:=Module[{len=IntegerLength[n^2],sq=ToString[n^2],qb=ToString[n^3]},

%t StringMatchQ[qb,StringInsert[sq,"**",Range[1,len+1]]]];

%t Select[Range[0,10^6],fQ[#]&] (* _Ivan N. Ianakiev_, Apr 06 2023 *)

%o (Python)

%o from itertools import count, islice, product

%o def ok(n):

%o s, t = n**2, n**3

%o while s and t:

%o if t%10 == s%10:

%o s //= 10

%o t //= 10

%o return s == 0

%o print([k for k in range(10**6+1) if ok(k)]) # _Michael S. Branicky_, Apr 02 2023

%o (Python)

%o from itertools import count, islice

%o def A362002_gen(startvalue=0): # generator of terms >= startvalue

%o for k in count(max(startvalue,0)):

%o c = iter(str((m:=k**2)*k))

%o if all(map(lambda b:any(map(lambda a:a==b,c)),str(m))):

%o yield k

%o A362002_list = list(islice(A362002_gen(),20)) # _Chai Wah Wu_, Apr 03 2023

%Y Cf. A046829, A362001.

%K nonn,base

%O 1,3

%A _Robert Israel_, Apr 02 2023

%E a(24) and beyond from _Michael S. Branicky_, Apr 02 2023