%I #11 Sep 08 2021 08:01:25
%S 9,8,7,6,5,4,3,2,1,90,9,8,7,6,5,4,3,2,1,80,9,8,7,6,5,4,3,2,1,70,9,8,7,
%T 6,5,4,3,2,1,60,9,8,7,6,5,4,3,2,1,50,9,8,7,6,5,4,3,2,1,40,9,8,7,6,5,4,
%U 3,2,1,30,9,8,7,6,5,4,3,2,1,20,9,8,7,6
%N Smallest number such that a carry occurs when adding it to n in decimal representation.
%H Reinhard Zumkeller, <a href="/A251984/b251984.txt">Table of n, a(n) for n = 1..9999</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Carry.html">Carry</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Carry_(arithmetic)">Carry (arithmetic)</a>
%F a(n) = (10 - A004151(n) mod 10) * 10^A122840(n).
%o (Haskell)
%o a251984 n = if d > 0 then 10 - d else 10 * a251984 n'
%o where (n',d) = divMod n 10
%o (Python)
%o def a(n):
%o s = str(n)
%o t = s.strip('0')
%o return (10 - int(t)%10) * 10**(len(s) - len(t))
%o print([a(n) for n in range(1, 85)]) # _Michael S. Branicky_, Sep 08 2021
%Y Cf. A004151, A122840, A031298, A167832.
%K nonn,base,look
%O 1,1
%A _Reinhard Zumkeller_, Dec 12 2014
|