%I #23 Aug 30 2021 22:24:19
%S 0,1,3,6,1,6,12,19,27,36,46,57,69,28,24,39,55,27,45,46,66,78,1,24,48,
%T 37,36,36,46,57,78,19,15,48,28,36,27,46,48,78,118,159,12,55,99,144,19,
%U 66,114,136,168,129,118,117,117,127,138,159,127,168
%N a(0) = 0; for n >= 1, a(n) = A004185(a(n-1)+n).
%H Robert P. P. McKone, <a href="/A345681/b345681.txt">Table of n, a(n) for n = 0..2999</a>
%F a(9*k+0 or 8) == 0 (mod 9);
%F a(9*k+1 or 4 or 7) == 1 (mod 9);
%F a(9*k+2 or 6) == 3 (mod 9);
%F a(9*k+3 or 5) == 6 (mod 9).
%e a(4) = A004185(6+4) = 1; a(13) = A004185(69+13) = 28.
%t a[0] := 0;
%t a[n_] := FromDigits[Sort[DeleteCases[IntegerDigits[a[n - 1] + n], 0]]];
%t Table[a[n], {n, 0, 59}] (* _Robert P. P. McKone_, Aug 16 2021 *)
%o (Python)
%o def A004185(n): return int("".join(sorted(str(n))).strip('0'))
%o def aupton(nn):
%o alst = [0]
%o for n in range(1, nn+1): alst.append(A004185(alst[-1]+n))
%o return alst
%o print(aupton(100)) # _Michael S. Branicky_, Jun 22 2021
%o (PARI) f(n) = fromdigits(vecsort(digits(n))); \\ A004185
%o a(n) = if (n==0, 0, f(a(n-1)+n)); \\ _Michel Marcus_, Jun 26 2021
%o (PARI) f(n) = fromdigits(vecsort(digits(n))); \\ A004185
%o lista(nn) = {my(v=vector(nn)); v[1] = 1; for (n=2, nn, v[n] = f(v[n-1]+n);); concat(0, v);} \\ _Michel Marcus_, Jun 26 2021
%Y Cf. A004185, A004719,
%K nonn,base
%O 0,3
%A _Ctibor O. Zizka_, Jun 22 2021
|