%I #17 Sep 06 2022 15:09:04
%S 0,102,110,140,150,170,209,210,260,330,4506,11620,17054,19008,20979,
%T 24120,27780,32305,32805,34590,42012,52054,55048,59049,65610,70536,
%U 75006,90432,111006,112050,118098,120594,136052,150297,153302,160824,181039,183708,208044
%N Records in A009101.
%o (Python)
%o import numpy
%o input_list = []
%o output_list = []
%o max_list = []
%o range_ = 10 ** 7
%o lower = 0
%o upper = lower + range_
%o for i in range(lower, upper):
%o input_list.append(i)
%o number = str(i)
%o results_list = []
%o total = 0
%o total_list = []
%o while True:
%o number_list = []
%o for x in list(number):
%o number_list.append(int(x))
%o results_list.append(numpy.prod(number_list))
%o total += numpy.prod(number_list)
%o if total in total_list:
%o output_list.append(total_list[-1])
%o if total_list[-1] >= max(output_list):
%o if total_list[-1] not in max_list:
%o max_list.append(total_list[-1])
%o break
%o total_list.append(total)
%o number = str(total)
%o print(max_list)
%o (Python)
%o from math import prod
%o from itertools import count, islice
%o def pd(n): return prod(map(int, str(n)))
%o def f(x): return x + pd(x)
%o def agen(): # generator of terms
%o record, seen = -1, set()
%o for n in count(0):
%o x = pd(n)
%o if x in seen: continue
%o seen.add(x)
%o fx = f(x)
%o while x != fx: x, fx = fx, f(fx)
%o if fx > record:
%o record = fx
%o yield record
%o print(list(islice(agen(), 39))) # _Michael S. Branicky_, Jun 21 2022
%Y Cf. A009101.
%K base,nonn
%O 0,2
%A _Marc-Thomas Russo_, Jun 03 2022