OFFSET
1,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(n+1) = A070196(a(n)). - Reinhard Zumkeller, Apr 03 2015
EXAMPLE
After 9143 the next term is 9143 + 1349 = 10492.
MAPLE
a:= proc(n) option remember; `if`(n=1, 1, (t->
t+parse(cat(sort(convert(t, base, 10))[])))(a(n-1)))
end:
seq(a(n), n=1..40); # Alois P. Heinz, Jan 15 2024
MATHEMATICA
NestList[#+FromDigits[Sort[IntegerDigits[#]]]&, 1, 40] (* Harvey P. Dale, Jul 24 2016 *)
PROG
(Haskell)
a033860 n = a033860_list !! (n-1)
a033860_list = iterate a070196 1
-- Reinhard Zumkeller, Apr 03 2015
(Python)
from itertools import islice
def agen(an=1): # generator of terms
while True: yield an; an = an + int("".join(sorted(str(an))))
print(list(islice(agen(), 100))) # Michael S. Branicky, Jan 15 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved