login
Length of "continued logarithm" expansion of n.
2

%I #23 Apr 05 2024 11:10:14

%S 1,1,2,1,2,2,4,1,2,2,4,2,5,4,6,1,2,2,4,2,5,4,6,2,7,5,5,4,5,6,8,1,2,2,

%T 4,2,5,4,6,2,7,5,5,4,5,6,8,2,9,7,6,5,6,5,6,4,8,5,7,6,6,8,10,1,2,2,4,2,

%U 5,4,6,2,7,5,5,4,5,6,8,2,9,7,6,5,6,5,6,4,8,5,7,6,6,8,10,2,11,9,7,7,8,6,9,5,7,6,8,5,7,6,9,4,9,8,11,5,6,7,7,6,7,6,8,8,9,10,12

%N Length of "continued logarithm" expansion of n.

%C It is known that a(n) is bounded by 2 log_2 (n) + 2; see my preprint linked below. - _Jeffrey Shallit_, Jun 14 2016

%H Rémy Sigrist, <a href="/A273126/b273126.txt">Table of n, a(n) for n = 1..16384</a>

%H Jon Borwein, Neil Calkin, Scott Lindstrom, and Andrew Mattingly, <a href="https://carmamaths.org/resources/jon/clogs.pdf">Continued logarithms and associated continued fractions</a>, preprint, 2016.

%H J. Shallit, <a href="http://arxiv.org/abs/1606.03881">Length of the continued logarithm algorithm on rational inputs</a>, arXiv:1606.03881 [math.NT], June 13 2016.

%e The expansions for n=2 to 19 are [1], [1,1], [2], [2,2], [2,1], [2,0,1,1], [3], [3,3], [3,2], [3,1,1,1], [3,1], [3,0,0,0,1], [3,0,1,1], [3,0,2,0,1,1], [4], [4,4], [4,3], [4,2,1,1]. - _R. J. Mathar_, Jun 02 2016

%e Displayed as a table with row lengths A000079 as suggested by a(A000079(k)) =1: - _R. J. Mathar_, Jun 04 2016

%e 1,

%e 1,2,

%e 1,2,2,4,

%e 1,2,2,4,2,5,4,6,

%e 1,2,2,4,2,5,4,6,2,7,5,5,4,5,6,8,

%e 1,2,2,4,2,5,4,6,2,7,5,5,4,5,6,8,2,9,7,6,5,6,5,6,4,8,5,7,6,6,8,10,

%e 1,2,2,4,2,5,4,6,2,7,5,5,4,5,6,8,2,9,7,6,5,6,5,6,4,8,5,7,6,6,8,10,2,11,9,7,7,8,6,9,5,7,6,8,5,7,6,9,4,9,8,11,5,6,7,7,6,7,6,8,8,9,10,12

%p A273126 := proc(n)

%p local a ,x,cf;

%p if n = 1 then

%p return 1;

%p end if;

%p cf := [] ;

%p x := n ;

%p while x > 1 do

%p a := ilog2(x) ;

%p cf := [op(cf),a] ;

%p x := x/2^a ;

%p if x = 1 then

%p break;

%p end if;

%p x := 1/(x-1) ;

%p end do:

%p nops(cf) ;

%p end proc:

%p seq(A273126(n),n=1..80) ; # _R. J. Mathar_, Jun 02 2016

%o (PARI) a(n) = my (x=n); for (w=1, oo, while (x>=2, x /= 2); if (x==1, return (w)); x = 1/(x-1); if (x<=1, return (w))) \\ _Rémy Sigrist_, Sep 09 2018

%K nonn

%O 1,3

%A _Jeffrey Shallit_, May 16 2016