login
Bisection of A287730.
3

%I #36 Jun 08 2017 05:19:52

%S 0,1,1,2,3,3,2,1,1,2,3,3,4,5,5,4,5,7,8,7,7,8,7,5,4,5,5,4,3,3,2,1,1,2,

%T 3,3,4,5,5,4,5,7,8,7,7,8,7,5,6,9,11,10,11,13,12,9,9,12,13,11,10,11,9,6

%N Bisection of A287730.

%C a(n)/A287731(n) enumerates all reduced fractions along the Stern-Brocot Tree. See the Serov link below.

%H I. V. Serov, <a href="/A287732/b287732.txt">Table of n, a(n) for n = 1..8192</a>

%H I. V. Serov, <a href="/A287732/a287732_1.png">OEIS: 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/Fo#fraction_trees">Index entries for fraction trees</a>

%H <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>

%F a(n) = A287730(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 = A287731(n) and s = a(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 s(2*n - 1) # _Indranil Ghosh_, Jun 08 2017

%Y Cf. A002487, A007306, A287729, A287730, A287731.

%K nonn,frac

%O 1,4

%A _I. V. Serov_, Jun 01 2017