OFFSET
1,2
COMMENTS
Start with any positive number n. Define f(n) as 'if n mod 3 = 1, f(n) = 4n-1; if n mod 3 = 2, f(n) = 4n+1; if n is divisible by 3, f(n) = n/3'. Apply this procedure repeatedly to reach 1. This sequence gives the number of steps required to reach 1, or -1 if 1 is never reached. The procedure is a modification of the famous Collatz procedure.
We can make a conjecture similar to that of Collatz to claim that the process will always reach 1. However, this is not proven yet.
It seems that more than 65 percent of the terms in this sequence satisfy a(i) = a(i+1). For example, 6655 of the first 10000 terms satisfy this condition.
LINKS
Md. Towhidul Islam, Table of n, a(n) for n = 1..10001
EXAMPLE
a(5)=6 because the trajectory of 5 is (5,21,7,27,9,3,1). That needs 6 repeated applications of the procedure to reach 1.
MAPLE
a:= proc(n) option remember; `if`(n=1, 0, 1 + (r->
a(`if`(r=0, q, 4*n+2*r-3)))(irem(n, 3, 'q')))
end:
seq(a(n), n=1..75); # Alois P. Heinz, Jan 20 2021
MATHEMATICA
a[n_] := a[n] = If[n == 1, 0, {q, r} = QuotientRemainder[n, 3]; 1 +
a[If[r == 0, q, 4n + 2r - 3]]];
Table[a[n], {n, 1, 75}] (* Jean-François Alcover, May 29 2022, after Alois P. Heinz *)
PROG
(PARI) f(n) = my(m=n%3); if (m==1, 4*n-1, if (m==2, 4*n+1, n/3));
a(n) = my(s=n, c=0); while(s>1, s=f(s); c++); c; \\ Michel Marcus, Jan 18 2021
CROSSREFS
KEYWORD
AUTHOR
Md. Towhidul Islam, Jan 15 2021
STATUS
approved