OFFSET
0,2
EXAMPLE
k=1 -> ND(k)=1; SD(k)=1.
k=20 -> ND(k)=2; SD(k)=2.
k=139 -> ND(k)=3 (second digit); SD(k)=13 (first and second digits).
k=300 -> ND(k)=3; SD(k)=3.
k=913 -> ND(k)=3 (third digit); SD(k)=13 (second and third digits).
k=1045 -> ND(k)=4 (third digit); SD(k)=10 (first and second digits).
etc.
MAPLE
P:=proc(n) local i, j, k, ok, w, x, t1, t2; for i from 1 by 1 to n do j:=trunc(1+evalf(log10(i))); w:=0; k:=i; ok:=0; while k>0 do x:=k-(trunc(k/10)*10); if x=j then ok:=1; fi; w:=w+x; k:=trunc(k/10); od; if ok=1 then t1:=convert(w, string); t2:=convert(i, string); if searchtext(t1, t2)>0 then print(i); fi; fi; od; end: P(10000);
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, May 27 2008
STATUS
approved