

A340300


a(n) is the number of iterations for n to reach 1 under the following scheme. If k == 0 (mod 3), then k > k/3, if k == 1 (mod 3) k > 2k, and if k == 2 (mod 3) add the middle two divisors of k and divide the result by 3.


1



0, 1, 1, 3, 2, 2, 3, 2, 2, 3, 4, 4, 4, 2, 3, 5, 3, 3, 5, 2, 4, 4, 3, 3, 4, 3, 3, 4, 4, 4, 6, 4, 5, 5, 4, 5, 6, 4, 5, 4, 3, 3, 5, 3, 4, 4, 6, 6, 5, 3, 4, 5, 4, 4, 5, 3, 6, 6, 3, 3, 6, 5, 5, 4, 3, 5, 5, 4, 4, 4, 4, 4, 6, 5, 5, 4, 3, 4, 5, 3, 4, 5, 5, 5, 4, 4, 5, 4, 5, 5, 4, 3, 7, 5, 3, 5, 7, 4, 6, 5, 6, 6, 6, 4, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,4


LINKS

Table of n, a(n) for n=1..105.


EXAMPLE

a(1) = 0 since 1 is already at 1 which requires no iteration of the scheme;
a(2) = 1 since (1 + 2)/3 > 1;
a(3) = 1 since 3/3 > 1;
a(4) = 3 since 4 > 8 > (2+4)/3 > 2 > 1;
a(5) = 2 since 5 > (1+5)/2 > 2 > 1;
a(6) = 2 since 6 > 2 > 1.


MATHEMATICA

f[n_] := f[n] = Switch[ Mod[n, 3], 0, n/3, 1, 2 n, 2, lst = Divisors@ n; len = Length@lst; (lst[[len/2]] + lst[[len/2 + 1]])/3]; a[n_] := Length@NestWhileList[f@# &, n, # > 1 &]; a[n_] := Length@ NestWhileList[f@# &, n, # > 1 &]  1; Array[a, 105]


CROSSREFS

Cf. A338459 (first occurrence of n).
Sequence in context: A052901 A127807 A122028 * A245070 A270226 A305534
Adjacent sequences: A340297 A340298 A340299 * A340301 A340302 A340303


KEYWORD

nonn


AUTHOR

Ali Sada and Robert G. Wilson v, Jan 03 2021


STATUS

approved



