%I #22 Mar 02 2021 01:16:31
%S 1,3,2,1,2,9,1,8,3,1,7,2,1,2,6,1,3,4,1,5,2,1,2,3,1,6,4,1,3,2,1,2,4,1,
%T 5,3,1,4,2,1,2,4,1,3,8,1,4,2,1,2,3,1,4,7,1,3,2,1,2,7,1,4,3,1,9,2,1,2,
%U 6,1,3,6,1,5,2,1,2,3,1,6,5,1,3,2,1,2,8,1,5,3,1,5,2,1,2,5,1,3,4,1,6
%N Number of steps >= 1 for iteration of map x -> (4/3)*ceiling(x) to reach an integer when started at n, or -1 if no such integer is ever reached.
%C It is conjectured that an integer is always reached.
%H J. C. Lagarias and N. J. A. Sloane, Approximate squaring (<a href="http://neilsloane.com/doc/apsq.pdf">pdf</a>, <a href="http://neilsloane.com/doc/apsq.ps">ps</a>), Experimental Math., 13 (2004), 113-128.
%p f := x->(4/3)*ceil(x); g := proc(n) local t1,c; global f; t1 := f(n); c := 1; while not type(t1, 'integer') do c := c+1; t1 := f(t1); od; RETURN([c,t1]); end;
%p # second Maple program:
%p a:= proc(n) local i; n; for i do 4/3*ceil(%);
%p if %::integer then return i fi od
%p end:
%p seq(a(n), n=0..100); # _Alois P. Heinz_, Mar 01 2021
%t f[n_] := Block[{c = 1, k = 4 n/3}, While[ ! IntegerQ@k, c++; k = 4 Ceiling@k/3]; c]; Table[f@n, {n, 0, 104}] (* _Robert G. Wilson v_ *)
%o (Python3)
%o from fractions import Fraction
%o def A085068(n):
%o c, x, m = 1, Fraction(4*n,3), Fraction(4,3)
%o while x.denominator > 1:
%o x = m*x.__ceil__()
%o c += 1
%o return c # _Chai Wah Wu_, Mar 01 2021
%Y Cf. A085058, A085071, A085328, A085330, A083514.
%K nonn
%O 0,2
%A _N. J. A. Sloane_, Aug 11 2003