%I #20 Jan 16 2024 02:36:43
%S 1,10,65,64,175,98,240,325,302,387,198,180,550,806,855,486,351,315,
%T 944,2428,2204,3172,1793,1316,937,2775,1815,1461,2541,9378,13327,9638,
%U 8149,6581,46965,23487,12198,10599,10920,52345,48788,180666,174870,291119,155563,915443
%N Least number of Sort-then-add persistence n.
%H Michael S. Branicky, <a href="/A033863/b033863.txt">Table of n, a(n) for n = 0..100</a>
%H Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a033/A033863.java">Java program</a> (github).
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Sort-Then-AddSequence.html">Sort-Then-Add Sequence</a>.
%o (Python)
%o from itertools import count, islice
%o def agen(LIMIT):
%o adict, n = dict(), 0
%o for k in count(1):
%o c, m = 0, k
%o while c <= LIMIT and m != (s:=int("".join(sorted(str(m))))):
%o m += s; c += 1
%o if c not in adict:
%o adict[c] = k
%o while n in adict and n <= LIMIT: yield adict[n]; n += 1
%o if n > LIMIT: return
%o print(list(agen(40))) # _Michael S. Branicky_, Jan 16 2024
%Y Cf. A033909, A033908.
%K nonn,base
%O 0,2
%A _David W. Wilson_
%E a(44)-a(45) from _Sean A. Irvine_, Jul 26 2020
|