OFFSET
1,2
COMMENTS
Compare with continued fraction A100338.
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
FORMULA
a(2*n-1) = n, a(2*n) = 2*a(n) for all n >= 1.
a((2*n-1)*2^p) = n * 2^p, p >= 0. - Johannes W. Meijer, Jun 22 2011
a(n) = n - (n AND n-1)/2. - Gary Detlefs, Jul 10 2014
a(n) = A285326(n)/2. - Antti Karttunen, Apr 19 2017
a(n) = A140472(n). - M. F. Hasler, Oct 19 2019
EXAMPLE
x=1.408494279228906985748474279080697991613998955782051281466263817524862977...
The continued fraction expansion of 2*x = A109170:
[2;1, 4,2, 6,2, 8,4, 10,3, 12,4, 14,4, 16,8, 18,5, ...]
which equals the continued fraction of x interleaved with the even numbers.
MAPLE
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
PROG
(PARI) a(n)=if(n%2==1, (n+1)/2, 2*a(n/2))
(Scheme, with memoization-macro definec)
;; Antti Karttunen, Apr 19 2017
(PARI) A109168(n)=(n+bitand(n, -n))\2 \\ M. F. Hasler, Oct 19 2019
CROSSREFS
Half the terms of A285326.
KEYWORD
cofr,nonn
AUTHOR
Paul D. Hanna, Jun 21 2005
STATUS
approved