This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A336383 #26 Sep 14 2020 11:50:40 %S A336383 0,1,21,31,42,52,73,81,319,391,463,583,2911,3667,6451,8793,9927, %T A336383 237126,254158,278393,2561363,9398143,9431623,9951265,83543869, %U A336383 83896381,83935261,2843233127,2847297383,2853748583,2885762663,266998137657,685718563667,688373877587 %N A336383 a(n) is the smallest number such that, with f(x) = x - (the product of the digits of x), f(a(n)) reaches a fixed point after n iterations. %C A336383 A fixed point occurs once the function returns a number that contains the digit 0. After that, the product of the digits will be 0, and so subtracting it from the number will be idempotent. %C A336383 This sequence is conceptually similar to A003001, though unlike the latter, it is probably infinite. %e A336383 a(9) = 391 because: %e A336383 1: 391 - 3*9*1 = 364 %e A336383 2: 364 - 3*6*4 = 292 %e A336383 3: 292 - 2*9*2 = 256 %e A336383 4: 256 - 2*5*6 = 196 %e A336383 5: 196 - 1*9*6 = 142 %e A336383 6: 142 - 1*4*2 = 134 %e A336383 7: 134 - 1*3*4 = 122 %e A336383 8: 122 - 1*2*2 = 118 %e A336383 9: 118 - 1*1*8 = 110 %e A336383 After iteration 9, the function becomes idempotent: %e A336383 10: 110 - 1*1*0 = 110 %e A336383 11: 110 - 1*1*0 = 110 %e A336383 12: 110 - 1*1*0 = 110 %e A336383 ... %e A336383 Additionally, 391 is the smallest number with this property. Thus, it is a(9). %t A336383 nmax = 20; tab = ConstantArray[Null, nmax]; %t A336383 For[k = 0, k <= 1000000, k++, %t A336383 l=Length@ NestWhileList[#-Times @@ IntegerDigits[#] &,k,UnsameQ[##] &, 2]-2; %t A336383 If[tab[[l+1]] == Null, tab[[l+1]] = k]]; tab (* _Robert Price_, Sep 13 2020 *) %o A336383 (Python) %o A336383 def f(x): %o A336383 prod = 1 %o A336383 for digit in str(x): %o A336383 prod *= int(digit) %o A336383 return x - prod %o A336383 def a(n): %o A336383 i = 0 %o A336383 iteration = 0 %o A336383 while iteration != n: %o A336383 i += 1 %o A336383 j = i %o A336383 iteration = 0 %o A336383 new_j = f(j) %o A336383 while j != new_j: %o A336383 iteration += 1 %o A336383 j = new_j %o A336383 new_j = f(j) %o A336383 return i %o A336383 (PARI) f(m) = m - vecprod(digits(m)) + (m==0); %o A336383 lista(nn) = {my(c, m, t); for(k=0, nn, c=0; m=k; while(m!=(m=f(m)), c++); if(c==t, print1(k, ", "); t++)); } \\ _Jinyuan Wang_, Aug 14 2020 %Y A336383 Cf. A003001, A070565. %K A336383 nonn,base %O A336383 0,3 %A A336383 _Alon Ran_, Jul 19 2020 %E A336383 a(27)-a(30) from _Jinyuan Wang_, Aug 14 2020 %E A336383 a(31)-a(33) added by _Michael S. Branicky_, Aug 29 2020