login
A249160
Smallest number of iterations k such that A068527^(k)(n)=A068527^(k+1)(n).
1
1, 0, 2, 1, 2, 3, 1, 2, 1, 4, 3, 2, 3, 1, 2, 1, 3, 2, 4, 3, 2, 3, 1, 2, 1, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 2, 4, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 2, 3, 2, 4, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 3, 4, 2, 3, 2, 4, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1
OFFSET
1,3
COMMENTS
Given a number n, denote its distance from next perfect square >= n as R(n), sequence A068527. The function R(n) has two fixed points, 0 and 2, and for all n>=3, R(n)<n. Thus for any n>=0, there exists a k>=0 such that R^(k)(n)=R^(k+1)(n)=0 or 2. This sequence gives the number of iterations needed to reach the fixed point starting at n.
This sequence is unbounded, but grows very slowly, reaching records of 1, 2, 3, 4, 6 etc at n=1, 3, 6, 10, 26, 170, 7226, etc.
EXAMPLE
R(10) = 6, R(6) = 3, R(3) = 1, R(1) = 0, R(0) = 0. Thus a(10) = 4.
MAPLE
A249160 := proc(n)
local k, prev, this;
prev := n ;
for k from 1 do
this := A068527(prev) ;
if this = prev then
return k-1;
end if;
prev := this ;
end do:
end proc:
seq(A249160(n), n=1..80) ; # R. J. Mathar, Nov 17 2014
MATHEMATICA
r[n_]:=Ceiling[Sqrt[n]]^2-n; Table[Length[FixedPointList[r, n]]-2, {n, 1, 100}]
PROG
(PARI) r(n)=if(issquare(n), 0, (sqrtint(n)+1)^2-n);
le(n)=b=0; while(n!=0&&n!=2, b=b+1; n=r(n)); return(b);
range(n) = c=List(); for(a = 1, n, listput(c, a)); return(c);
apply(le, range(100))
CROSSREFS
Cf. A068527.
Sequence in context: A082691 A280052 A183198 * A346913 A269970 A333518
KEYWORD
nonn,easy
AUTHOR
Valtteri Raiko, Oct 22 2014
STATUS
approved