OFFSET
0,3
COMMENTS
Duplicate digits are eliminated as in A137564.
No term can be greater than 9876543210.
a(260390084) = 9876543210. - Michael S. Branicky, Apr 09 2024
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20000
EXAMPLE
a(17) = 653 since the sum of a(0) through a(16) is 65536, and eliminating repeated digits gives a(17) = A137564(65536) = 653.
MATHEMATICA
seq={1}; Do[s=Total[seq]; AppendTo[seq, FromDigits[DeleteDuplicates[IntegerDigits[s]]]], 43]; seq (* James C. McMahon, Apr 09 2024 *)
PROG
(PARI) f(n) = my(d=digits(n)); fromdigits(vecextract(d, vecsort(vecsort(d, , 9)))) \\ A137564
lista(nn) = my(va=vector(nn)); va[1] = 1; for (n=2, nn, va[n] = f(sum(j=1, n-1, va[j])); ); va; \\ Michel Marcus, Mar 08 2024
(Python)
from itertools import islice
def A137564(n):
seen, out, s = set(), "", str(n)
for d in s:
if d not in seen: out += d; seen.add(d)
return int(out)
def A370748gen(): # generator of terms
an, s = 1, 0
while True:
yield an
s += an
an = A137564(s)
print(list(islice(A370748gen(), 45))) # Michael S. Branicky, Apr 09 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Sergio Pimentel, Mar 07 2024
STATUS
approved