[go: up one dir, main page]

login
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

%I #17 Mar 02 2021 19:11:54

%S 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,

%T 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,

%U 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

%N 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.

%e a(1) = 0 since 1 is already at 1 which requires no iteration of the scheme;

%e a(2) = 1 since (1 + 2)/3 -> 1;

%e a(3) = 1 since 3/3 -> 1;

%e a(4) = 3 since 4 -> 8 -> (2+4)/3 -> 2 -> 1;

%e a(5) = 2 since 5 -> (1+5)/2 -> 2 -> 1;

%e a(6) = 2 since 6 -> 2 -> 1.

%t 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]

%Y Cf. A338459 (first occurrence of n).

%K nonn

%O 1,4

%A _Ali Sada_ and _Robert G. Wilson v_, Jan 03 2021