OFFSET
1,1
COMMENTS
LINKS
Paul Tek, Table of n, a(n) for n = 1..10000
Paul Tek, PARI program for this sequence
EXAMPLE
To compute a(n):
(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),
(2) Increment D,
(3) Replace the digits after D by A051885((sum of the digits after D) - 1), left padded with zeros.
For n = 2930:
(1) We choose the 4th digit,
(2) We increment the 4th digit,
(3) We replace the last 3 digits with "029" (= A051885((9+3+0)-1) left padded with zeros to 3 digits).
Hence, a(2930) = 3029.
MATHEMATICA
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 *)
PROG
(PARI) See Link section.
(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
(Python)
def A228915(n):
p = r = 0
while True:
d = n % 10
if d < 9 and r: return (n+1)*10**p+A051885(r-1)
n //= 10; r += d; p += 1
# (Based on Tek's PARI program.) - M. F. Hasler, Mar 15 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Paul Tek, Sep 08 2013
STATUS
approved