login
A327007
a(n) = number of iterations of f(x)=floor((x^2+n)/(2x)) starting at x=n to reach the value floor(sqrt(n)) (=A000196(n)).
4
0, 1, 2, 1, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4
OFFSET
1,3
COMMENTS
Also, we have f(x) = floor((x + floor(n/x))/2).
Notice that f(n) = f(1) = floor((n+1)/2), and so the starting value x = 1 gives the same sequence.
Iterations f(f(...f(a))...) reach floor(sqrt(n)) for any starting integer a >= 1. They either stabilize to floor(sqrt(n)) or alternate between floor(sqrt(n)) and ceiling(sqrt(n)).
PROG
(PARI) { A327007(n, a=n) = my(k = 0); while(1, my(b = (a+n\a)\2); if(b >= a, break); a = b; k++); k; }
CROSSREFS
KEYWORD
nonn
AUTHOR
Max Alekseyev, Aug 12 2019
STATUS
approved