%I #4 Aug 24 2012 10:49:59
%S 0,0,0,0,0,0,0,0,0,9,18,27,36,45,54,63,72,81,180,279,378,477,576,675,
%T 774,873,972,1971,2970,3969,4968,5967,6966,7965,8964,9963,19962,29961,
%U 39960,49959,59958,69957,79956,89955,99954,199953,299952,399951
%N a(n) is the smallest number m such that the sum of the digits of n+m is n.
%C All the numbers are divisible by 9.
%e a(17) = 72 because 89 is the smallest number having digit sum 17 and 17+ 72=89.
%t a[n_] := Module[{k},k=0;While[Not[Plus@@IntegerDigits[n + k] == n], k = k + 9]; k]; Table[a[n], {n, 1, 50}]
%K base,easy,nonn
%O 0,10
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Jul 09 2007
%E Edited by _Stefan Steinerberger_, Jul 14 2007