%I #44 Jun 10 2017 03:49:28
%S 1,1,2,1,1,2,3,3,4,5,5,4,3,3,2,1,1,2,3,3,4,5,5,4,5,7,8,7,7,8,7,5,6,9,
%T 11,10,11,13,12,9,9,12,13,11,10,11,9,6,5,7,8,7,7,8,7,5,4,5,5,4,3,3,2,1
%N Bisection of A287729.
%C A287732(n)/a(n) enumerates all reduced fractions along the Stern-Brocot Tree. See the Serov link below.
%H I. V. Serov, <a href="/A287731/b287731.txt">Table of n, a(n) for n = 1..8192</a>
%H I. V. Serov, <a href="/A287731/a287731.png">The Stern-Brocot Tree as Sequence A287732/A287731</a>
%H N. J. A. Sloane, <a href="/stern_brocot.html">Stern-Brocot or Farey Tree</a>
%H <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%H <a href="/index/Fo#fraction_trees">Index entries for fraction trees</a>
%F a(n) = A287729(2*n-1), n > 0.
%F a(n) = A287730(n-1) + A287730(n), n > 0.
%F a(n) = A007306(n) - A287732(n) .
%F Consider for n > 1 the binary expansion b(1:t) of n-1 without the leading 1.
%F Recurse: c=s=1; for j=1:t {if b(t-j+1) == mod(t,2) s = s+c; else c = c+s;}
%F Then: c = a(n) and s = A287732(n);
%o (Python)
%o def c(n): return 1 if n==1 else s(n/2) if n%2==0 else s((n - 1)/2) + s((n + 1)/2)
%o def s(n): return 0 if n==1 else c(n/2) if n%2==0 else c((n - 1)/2) + c((n + 1)/2)
%o def a(n): return c(2*n - 1) # _Indranil Ghosh_, Jun 08 2017
%Y Cf. A002487, A007306, A287729, A287730, A287732.
%K nonn,frac
%O 1,3
%A _I. V. Serov_, Jun 01 2017