OFFSET
1,3
COMMENTS
It is conjectured that this algorithm will always terminate at 1 or 9.
Jim Nastos verified the conjecture for n <= 64*10^5.
Jim Nastos verified the conjecture for n <= 45248000.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
For n = 11: 11+10=21; 21+15=36; 36/2=18; 18/2=9; taking 4 steps to reach 9, so a(11)=4.
MAPLE
LT:= proc(k) local n;
n:= ceil((sqrt(1+8*k)-1)/2);
n*(n-1)/2
end proc:
f:= proc(k) option remember; if k::even then 1+procname(k/2) else 1+procname(k+LT(k))fi
end proc:
f(1):=0: f(9):= 0:
map(f, [$1..100]); # Robert Israel, Oct 23 2019
MATHEMATICA
LT[k_] := Module[{n}, n = Ceiling[(Sqrt[1+8k]-1)/2]; n(n-1)/2]; f[k_] := f[k] = If[EvenQ[k], 1+f[k/2], 1+f[k+LT[k]]]; f[1] = 0; f[9] = 0;
Array[f, 100] (* Jean-François Alcover, Aug 27 2022, after Robert Israel *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Ali Sada, Oct 21 2019
STATUS
approved