A251984 Smallest number such that a carry occurs when adding it to n in decimal representation.
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, 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, 3, 2, 1, 30, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 9, 8, 7, 6
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..9999
- Eric Weisstein's World of Mathematics, Carry
- Wikipedia, Carry (arithmetic)
Programs
-
Haskell
a251984 n = if d > 0 then 10 - d else 10 * a251984 n' where (n',d) = divMod n 10
-
Python
def a(n): s = str(n) t = s.strip('0') return (10 - int(t)%10) * 10**(len(s) - len(t)) print([a(n) for n in range(1, 85)]) # Michael S. Branicky, Sep 08 2021