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 A340595 #5 Jan 14 2021 02:48:03 %S A340595 2,4,8,21,42,65,80,217,488,721,2120,2349,2796,9214,16043,23287,28626, %T A340595 43588,58176,116982,213435,444329,640673,967248,1399895,1449156, %U A340595 1528785,2768054,2915135,3631071,3673118,5032731,12977420 %N A340595 a(n) is the least k for which A340594(k) = n. %C A340595 a(n) is the least k >= 2 from which it takes exactly n iterations of A340592 to reach 0, 1 or a prime. %e A340595 Starting from 21, it takes 3 iterations of A340592 to reach 0,1 or a prime: 21 -> 16 -> 14 -> 13. Since this is the first case where 3 iterations are required, a(3) = 21. %p A340595 dcat:= proc(L) local i, x; %p A340595 x:= L[-1]; %p A340595 for i from nops(L)-1 to 1 by -1 do %p A340595 x:= 10^(1+ilog10(x))*L[i]+x %p A340595 od; %p A340595 x %p A340595 end proc: %p A340595 f:= proc(n) local F; %p A340595 F:= sort(ifactors(n)[2], (a, b) -> a[1] < b[1]); %p A340595 dcat(map(t -> t[1]$t[2], F)) mod n; %p A340595 end proc: %p A340595 g:= proc(n) option remember; %p A340595 if isprime(n) then 0 else 1 + procname(f(n)) fi %p A340595 end proc: %p A340595 g(0):= 0: g(1):= 0: %p A340595 V:= Array(0..30): count:= 0: %p A340595 for n from 2 while count < 31 do %p A340595 v:= f(n); %p A340595 if v::integer and v <= 100 and V[v] = 0 then %p A340595 count:= count+1; V[v]:= n; %p A340595 fi %p A340595 od: %p A340595 convert(V,list); %Y A340595 Cf. A340592, A340594. %K A340595 nonn %O A340595 0,1 %A A340595 _J. M. Bergot_ and _Robert Israel_, Jan 13 2021