Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #8 Jan 14 2021 18:12:30
%S 0,0,1,0,1,0,2,2,1,0,1,0,1,1,2,0,1,0,1,3,1,0,2,1,1,3,1,0,2,0,2,2,1,2,
%T 1,0,1,1,2,0,4,0,1,2,2,0,1,2,1,1,1,0,1,3,1,2,4,0,2,0,3,2,2,5,1,0,1,1,
%U 1,0,3,0,2,4,2,2,2,0,6,2,3,0,1,1,1,2,3,0,2,3,2,2,1,2,1,0,3,2
%N a(n) is the number of iterations of A340592 starting from n, until 0, 1 or a prime is reached.
%C a(n) = 0 if n is prime.
%H Robert Israel, <a href="/A340594/b340594.txt">Table of n, a(n) for n = 2..10000</a>
%F a(n) = A066247(n)*(1 + a(A340592(n))).
%e A340592(21) = 16, A340592(16) = 14, A340592(14) = 13 is prime, so a(21) = 3.
%p dcat:= proc(L) local i, x;
%p x:= L[-1];
%p for i from nops(L)-1 to 1 by -1 do
%p x:= 10^(1+ilog10(x))*L[i]+x
%p od;
%p x
%p end proc:
%p f:= proc(n) local F;
%p F:= sort(ifactors(n)[2], (a, b) -> a[1] < b[1]);
%p dcat(map(t -> t[1]$t[2], F)) mod n;
%p end proc:
%p g:= proc(n) option remember;
%p if isprime(n) then 0 else 1 + procname(f(n)) fi
%p end proc:
%p g(0):= 0: g(1):= 0:
%p map(g, [$1..1000]);
%Y Cf. A066247, A340592, A340595.
%K nonn
%O 2,7
%A _J. M. Bergot_ and _Robert Israel_, Jan 13 2021