login
A199343
Least integer > n having a larger or the same digital sum as n.
2
1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 11, 12, 13, 14, 15, 16, 17, 18, 19, 28, 21, 22, 23, 24, 25, 26, 27, 28, 29, 38, 31, 32, 33, 34, 35, 36, 37, 38, 39, 48, 41, 42, 43, 44, 45, 46, 47, 48, 49, 58, 51, 52, 53, 54, 55, 56, 57, 58, 59, 68, 61, 62, 63, 64, 65, 66, 67, 68, 69, 78, 71, 72, 73, 74, 75, 76, 77, 78, 79, 88, 81, 82, 83, 84, 85, 86, 87, 88, 89, 98, 91, 92, 93, 94, 95, 96, 97, 98, 99, 189
OFFSET
0,2
COMMENTS
If n does not end in 9, then a(n) = n + 1, else a(n) is obtained by increasing the last digit of n not equal to 9, and by decreasing the immediately following 9 by 1 (as to get an 8), which is equivalent to adding 9*10^(d-1) where d is the number of trailing 9's in n. In the first case the digital sum of a(n) is 1 more than that of n; in the second case these digital sums are equal.
FORMULA
a(n) = n + 1 unless n=9 (mod 10).
a(n) = n + 9*10^(valuation(n+1,10)-1) if this valuation (largest power of 10 to divide n+1) is positive.
The two cases can be unified as: a(n) = n + ceiling(9*10^(valuation(n+1,10)-1)).
PROG
(PARI) A199343(n)= n+if(n%10<9, 1, 9*10^(valuation(n+1, 10)-1))
CROSSREFS
Cf. A199344.
Sequence in context: A335493 A319725 A048408 * A118765 A131646 A032864
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Nov 07 2011
STATUS
approved