%I #27 Mar 18 2022 13:17:10
%S 10,11,12,13,14,15,16,17,18,100,20,21,22,23,24,25,26,27,28,101,30,31,
%T 32,33,34,35,36,37,38,102,40,41,42,43,44,45,46,47,48,103,50,51,52,53,
%U 54,55,56,57,58,104,60,61,62,63,64,65,66,67,68,105,70,71,72
%N Next larger integer with same digital sum (that is, sum of digits in base 10) as n.
%C This is a variant of A057168 for the base 10.
%C All integers except those in A051885 appear in this sequence.
%C n+9 <= a(n) <= 10*n, for any n > 0.
%C a(n)-n is a multiple of 9, for any n > 0.
%H Paul Tek, <a href="/A228915/b228915.txt">Table of n, a(n) for n = 1..10000</a>
%H Paul Tek, <a href="/A228915/a228915.txt">PARI program for this sequence</a>
%e To compute a(n):
%e (1) Choose the rightmost digit D of n strictly less than 9 and with at least one nonzero digit after it (note that D may be a leading zero),
%e (2) Increment D,
%e (3) Replace the digits after D by A051885((sum of the digits after D) - 1), left padded with zeros.
%e For n = 2930:
%e (1) We choose the 4th digit,
%e (2) We increment the 4th digit,
%e (3) We replace the last 3 digits with "029" (= A051885((9+3+0)-1) left padded with zeros to 3 digits).
%e Hence, a(2930) = 3029.
%t nli[n_]:=Module[{k=n+1,s=Total[IntegerDigits[n]]},While[Total[ IntegerDigits[ k]] !=s, k++]; k]; Array[nli,70] (* _Harvey P. Dale_, Sep 27 2016 *)
%o (PARI) See Link section.
%o (PARI) A228915(n,p=1,d,r)={while(8<(d=n%10) || !r, n\=10; r+=d; p*=10); n*p+p+A051885(r-1)} \\ (Based on the above program.) - _M. F. Hasler_, Mar 15 2022
%o (Python)
%o def A228915(n):
%o p = r = 0
%o while True:
%o d = n % 10
%o if d < 9 and r: return (n+1)*10**p+A051885(r-1)
%o n //= 10; r += d; p += 1
%o # (Based on Tek's PARI program.) - _M. F. Hasler_, Mar 15 2022
%Y Cf. A007953, A051885, A057168.
%K base,nonn
%O 1,1
%A _Paul Tek_, Sep 08 2013