cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A287732 Bisection of A287730.

This page as a plain text file.
%I A287732 #36 Jun 08 2017 05:19:52
%S A287732 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 A287732 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 A287732 Bisection of A287730.
%C A287732 a(n)/A287731(n) enumerates all reduced fractions along the Stern-Brocot Tree. See the Serov link below.
%H A287732 I. V. Serov, <a href="/A287732/b287732.txt">Table of n, a(n) for n = 1..8192</a>
%H A287732 I. V. Serov, <a href="/A287732/a287732_1.png">OEIS: The Stern-Brocot Tree as Sequence A287732/A287731</a>
%H A287732 N. J. A. Sloane, <a href="/stern_brocot.html">Stern-Brocot or Farey Tree</a>
%H A287732 <a href="/index/Fo#fraction_trees">Index entries for fraction trees</a>
%H A287732 <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%F A287732 a(n) = A287730(2*n-1), n > 0.
%F A287732 a(n) = A287730(n-1) + A287730(n), n > 0.
%F A287732 a(n) = A007306(n) - A287732(n).
%F A287732 Consider for n > 1 the binary expansion b(1:t) of n-1 without the leading 1.
%F A287732 Recurse: c=s=1; for j=1:t {if b(t-j+1) == mod(t,2) s = s+c; else c = c+s;}
%F A287732 Then: c = A287731(n) and s = a(n);
%o A287732 (Python)
%o A287732 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 A287732 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 A287732 def a(n): return s(2*n - 1) # _Indranil Ghosh_, Jun 08 2017
%Y A287732 Cf. A002487, A007306, A287729, A287730, A287731.
%K A287732 nonn,frac
%O A287732 1,4
%A A287732 _I. V. Serov_, Jun 01 2017