login

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”).

A340594
a(n) is the number of iterations of A340592 starting from n, until 0, 1 or a prime is reached.
3
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, 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, 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
OFFSET
2,7
COMMENTS
a(n) = 0 if n is prime.
LINKS
FORMULA
a(n) = A066247(n)*(1 + a(A340592(n))).
EXAMPLE
A340592(21) = 16, A340592(16) = 14, A340592(14) = 13 is prime, so a(21) = 3.
MAPLE
dcat:= proc(L) local i, x;
x:= L[-1];
for i from nops(L)-1 to 1 by -1 do
x:= 10^(1+ilog10(x))*L[i]+x
od;
x
end proc:
f:= proc(n) local F;
F:= sort(ifactors(n)[2], (a, b) -> a[1] < b[1]);
dcat(map(t -> t[1]$t[2], F)) mod n;
end proc:
g:= proc(n) option remember;
if isprime(n) then 0 else 1 + procname(f(n)) fi
end proc:
g(0):= 0: g(1):= 0:
map(g, [$1..1000]);
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Jan 13 2021
STATUS
approved