A051885(n) = ((n%9)+1)*10^(n\9)-1 a(n) = \ my (r=0, p=0, d); \ while (1, \ d = n%10; \ if (d<9 && r>0, \ return ((n+1)*10^p + A051885(r-1)) \ ); \ n = n\10; \ p = p+1; \ r = r+d \ )