OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
f:= proc(m) local k, S, r, s, j, g;
if m=1 then return 1 fi;
g:= igcd(m, 10);
if g > 1 then
k:= max(padic:-ordp(g, 2), padic:-ordp(g, 5));
return 10^k*procname(m/g)
fi;
S[-1]:={0}: S[0]:= {1};
for k from 1 do
S[k]:= S[k-1] union (10^k +~S[k-1] mod m);
if min(S[k]) = 0 then break fi;
od:
r:= 10^k; s:= (-10^k) mod m;
for j from k-1 by -1 to 0 do
if not member(s, S[j-1]) then s:= (s - 10^j) mod m; r:= r + 10^j fi;
od;
r;
end proc:
g:= proc(n) local digs;
digs:= select(t -> n mod t = 0, [$1..9]);
min(seq(d*f(n/d), d=digs))
end proc:
map(g, [$1..100]); # Robert Israel, Nov 21 2016
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Oct 12 2003
EXTENSIONS
More terms from Ray Chandler, Oct 18 2003
STATUS
approved