%I #26 Oct 25 2019 12:29:37
%S 1,2,2,4,3,4,4,8,5,6,6,8,7,8,8,16,9,10,10,12,11,12,12,16,13,14,14,16,
%T 15,16,16,32,17,18,18,20,19,20,20,24,21,22,22,24,23,24,24,32,25,26,26,
%U 28,27,28,28,32,29,30,30,32,31,32,32,64,33,34,34,36,35,36,36,40,37,38,38
%N Continued fraction expansion of the constant x (A109169) such that the continued fraction of 2*x yields the continued fraction of x interleaved with the positive even numbers.
%C Compare with continued fraction A100338.
%C The sequence is equal to the sequence of positive integers (1, 2, 3, 4, ...) interleaved with the sequence multiplied by two, 2*(1, 2, 2, 4, 3, ...) = (2, 4, 4, 8, 6, ...): see the first formula. - _M. F. Hasler_, Oct 19 2019
%F a(2*n-1) = n, a(2*n) = 2*a(n) for all n >= 1.
%F a((2*n-1)*2^p) = n * 2^p, p >= 0. - _Johannes W. Meijer_, Jun 22 2011
%F a(n) = n - (n AND n-1)/2. - _Gary Detlefs_, Jul 10 2014
%F a(n) = A285326(n)/2. - _Antti Karttunen_, Apr 19 2017
%F a(n) = A140472(n). - _M. F. Hasler_, Oct 19 2019
%e x=1.408494279228906985748474279080697991613998955782051281466263817524862977...
%e The continued fraction expansion of 2*x = A109170:
%e [2;1, 4,2, 6,2, 8,4, 10,3, 12,4, 14,4, 16,8, 18,5, ...]
%e which equals the continued fraction of x interleaved with the even numbers.
%p nmax:=75; pmax:= ceil(log(nmax)/log(2)); for p from 0 to pmax do for n from 1 to nmax do a((2*n-1)*2^p):= n*2^p: od: od: seq(a(n), n=1..nmax); # _Johannes W. Meijer_, Jun 22 2011
%o (PARI) a(n)=if(n%2==1,(n+1)/2,2*a(n/2))
%o (Scheme, with memoization-macro definec)
%o (definec (A109168 n) (if (zero? n) n (if (odd? n) (/ (+ 1 n) 2) (* 2 (A109168 (/ n 2))))))
%o ;; _Antti Karttunen_, Apr 19 2017
%o (PARI) A109168(n)=(n+bitand(n,-n))\2 \\ _M. F. Hasler_, Oct 19 2019
%Y Cf. A109169 (digits of x), A109170 (continued fraction of 2*x), A109171 (digits of 2*x).
%Y Cf. A006519 and A129760. [_Johannes W. Meijer_, Jun 22 2011]
%Y Half the terms of A285326.
%K cofr,nonn
%O 1,2
%A _Paul D. Hanna_, Jun 21 2005
|