%I #11 Sep 08 2024 22:31:57
%S 1,2,3,4,5,6,7,8,9,10,11,12,132,140,15,162,175,184,198,20,210,22,234,
%T 24,250,264,2702,280,2916,30,312,324,33,348,3510,36,378,384,396,40,
%U 412,420,432,44,4500,468,476,48,4932,50,510,520,5310,540,55,5610,5705,5800,5940
%N Smallest integer that starts with n and is divisible by every nonzero digit of n.
%C Note that a number that starts with n and is divisible by lcm(1, 2, ..., 9) = 2520 always satisfies the conditions. And there is such a number between n0000 and n2519. Therefore a(n) < 10000n + 2520. Hence to find a(n) one needs to check numbers n, n0..n9, n00..n99, n000..n999, n0000..n2519.
%H Robert Israel, <a href="/A132378/b132378.txt">Table of n, a(n) for n = 1..10000</a>
%H TopCoder problem <a href="http://www.topcoder.com/stat?c=problem_statement&pm=8318">DivisibleByDigits</a>
%p f:= proc(n) local r, d, q ;
%p r:= ilcm(op(convert(convert(n,base,10),set) minus {0,1}));
%p if n mod r = 0 then return n fi;
%p for d from 1 do
%p q:= -(n*10^d) mod r;
%p if q < 10^d then return n*10^d+q fi;
%p od
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Feb 01 2017
%K base,easy,nonn
%O 1,2
%A Mikhail Dvorkin (mikhail.dvorkin(AT)gmail.com), Nov 10 2007