A152975 Numerators of the redundant Stern-Brocot structure; denominators=A152976.
1, 1, 3, 2, 1, 3, 2, 5, 3, 6, 3, 1, 3, 2, 5, 3, 6, 3, 7, 4, 9, 5, 10, 5, 9, 4, 1, 3, 2, 5, 3, 6, 3, 7, 4, 9, 5, 10, 5, 9, 4, 9, 5, 12, 7, 15, 8, 15, 7, 14, 7, 15, 8, 15, 7, 12, 5, 1, 3, 2, 5, 3, 6, 3, 7, 4, 9, 5, 10, 5, 9, 4, 9, 5, 12, 7, 15, 8, 15, 7, 14, 7, 15, 8, 15, 7, 12, 5, 11, 6, 15, 9, 20, 11, 21
Offset: 1
A047679 Denominators in full Stern-Brocot tree.
1, 2, 1, 3, 3, 2, 1, 4, 5, 5, 4, 3, 3, 2, 1, 5, 7, 8, 7, 7, 8, 7, 5, 4, 5, 5, 4, 3, 3, 2, 1, 6, 9, 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, 7, 11, 14, 13, 15, 18, 17, 13, 14, 19, 21, 18, 17, 19, 16, 11, 11, 16, 19, 17, 18
Offset: 0
Comments
Numerators are A007305.
Write n in binary; list run lengths; add 1 to last run length; make into continued fraction. Sequence gives denominator of fraction obtained.
From Reinhard Zumkeller, Dec 22 2008: (Start)
For n > 1: a(n) = if A025480(n-1) != 0 and A025480(n) != 0 then = a(A025480(n-1)) + a(A025480(n)) else if A025480(n)=0 then a(A025480(n-1))+0 else 1+a(A025480(n-1));
From Yosu Yurramendi, Jun 25 2014 and Jun 30 2014: (Start)
If the terms are written as an array a(m, k) = a(2^(m-1)-1+k) with m >= 1 and k = 0, 1, ..., 2^(m-1)-1:
1,
2,1,
3,3, 2, 1,
4,5, 5, 4, 3, 3, 2,1,
5,7, 8, 7, 7, 8, 7,5,4, 5, 5, 4, 3, 3,2,1,
6,9,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,
then the sum of the m-th row is 3^(m-1), and each column is an arithmetic sequence. The differences of these arithmetic sequences give the sequence A007306(k+1). The first terms of columns are 1 for k = 0 and a(k-1) for k >= 1.
In a row reversed version A(m, k) = a(m, m-(k+1)):
1
1,2
1,2,3,3,
1,2,3,3,4,5,5,4
1,2,3,3,4,5,5,4,5,7,8,7,7,8,7,5
1,2,3,3,4,5,5,4,5,7,8,7,7,8,7,5,6,9,11,10,11,13,12,12,9,9,12,13,11,10,11,9,6
each column k >= 0 is constant, namely A007306(k+1).
This row reversed version coincides with the array for A007305 (see the Jun 25 2014 comment there). (End)
Looking at the plot, the sequence clearly shows a fractal structure. (The repeating pattern oddly resembles the [first completed] facade of the Sagrada Familia!) - Daniel Forgues, Nov 15 2019
Examples
E.g., 57->111001->[ 3,2,1 ]->[ 3,2,2 ]->3 + 1/(2 + 1/(2) ) = 17/2. For n=1,2, ... we get 2, 3/2, 3, 4/3, 5/3, 5/2, 4, 5/4, 7/5, 8/5, ... 1; 2,1; 3,3,2,1; 4,5,5,4,3,3,2,1; .... Another version of Stern-Brocot is A007305/A047679 = 1, 2, 1/2, 3, 1/3, 3/2, 2/3, 4, 1/4, 4/3, 3/4, 5/2, 2/5, 5/3, 3/5, 5, 1/5, 5/4, 4/5, ...
Links
Programs
-
Mathematica
CFruns[ n_Integer ] := Fold[ #2+1/#1&, Infinity, Reverse[ MapAt[ #+1&, Length/@Split[ IntegerDigits[ n, 2 ] ], {-1} ] ] ] (* second program: *) a[n_] := Module[{LL = Length /@ Split[IntegerDigits[n, 2]]}, LL[[-1]] += 1; FromContinuedFraction[LL] // Denominator]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 25 2016 *)
-
PARI
{a(n) = local(v, w); v = binary(n++); w = [1]; for( n=2, #v, if( v[n] != v[n-1], w = concat(w, 1), w[#w]++)); w[#w]++; contfracpnqn(w)[2, 1]} /* Michael Somos, Jul 22 2011 */
-
R
a <- 1 for(m in 1:6) for(k in 0:(2^(m-1)-1)) { a[2^m+ k] = a[2^(m-1)+k] + a[2^m-k-1] a[2^m+2^(m-1)+k] = a[2^(m-1)+k] } a # Yosu Yurramendi, Dec 31 2014
Formula
a(n) = SternBrocotTreeDen(n) # n starting from 1.
From Yosu Yurramendi, Jul 02 2014: (Start)
For m >0 and 0 <= k < 2^(m-1), with a(0)=1, a(1)=2:
a(2^m+k-1) = a(2^(m-1)+k-1) + a((2^m-1)-k-1);
a(2^m+2^(m-1)+k-1) = a(2^(m-1)+k-1). (End)
a(2^m-2^q ) = q+1, q >= 0, m > q
a(2^m-2^q-1) = q+2, q >= 0, m > q+1. - Yosu Yurramendi, Jan 01 2015
a(2^(m+1)-1-k) = A007306(k+1), m >= 0, 0 <= k <= 2^m. - Yosu Yurramendi, May 20 2019
Extensions
Edited by Wolfdieter Lang, Mar 31 2015
A060188 A column and diagonal of A060187.
1, 6, 23, 76, 237, 722, 2179, 6552, 19673, 59038, 177135, 531428, 1594309, 4782954, 14348891, 43046704, 129140145, 387420470, 1162261447, 3486784380, 10460353181, 31381059586, 94143178803, 282429536456, 847288609417
Offset: 2
Comments
Sums of rows of the numerators and of the denominators of the redundant Stern-Brocot structure A152975/A152976: a(n+2) = Sum_{k=2^n..(2^(n+1) -1)} A152975(k) = Sum_{k=2^n..(2^(n+1) -1)} A152976(k). - Reinhard Zumkeller, Dec 22 2008
Links
- Vincenzo Librandi, Table of n, a(n) for n = 2..2000
- P. A. MacMahon, The divisors of numbers, Proc. London Math. Soc., (2) 19 (1920), 305-340; Coll. Papers II, pp. 267-302.
- Index entries for linear recurrences with constant coefficients, signature (5,-7,3).
Programs
-
Magma
[3^(n-1)-n: n in [2..30]]; // Vincenzo Librandi, Sep 05 2011
-
Maple
a[0]:=1:for n from 1 to 24 do a[n]:=(4*a[n-1]-3*a[n-2]+2) od: seq(a[n], n=0..24); # Zerinvary Lajos, Jun 08 2007
-
Mathematica
Table[3^(n-1) -n, {n,2,30}] (* Vladimir Joseph Stephan Orlovsky, Nov 15 2008 *) LinearRecurrence[{5,-7,3},{1,6,23},30] (* Harvey P. Dale, Jul 03 2024 *)
-
Sage
[3^(n-1) -n for n in (2..32)] # G. C. Greubel, Jan 07 2022
Formula
a(n) = 3^(n-1) - n = A061980(n-1, 2). - Henry Bottomley, May 24 2001
From Paul Barry, Jun 24 2003: (Start)
With offset 0, this is 3^(n+1) - n - 2.
Partial sums of A048473. (End)
From Colin Barker, Dec 19 2012: (Start)
a(n) = 5*a(n-1) - 7*a(n-2) + 3*a(n-3).
G.f.: x^2*(1 + x)/((1-x)^2*(1-3*x)). (End)
E.g.f.: (exp(3*x) - 3*x*exp(x) - 1)/3. - Wolfdieter Lang, Apr 17 2017
Extensions
More terms from Vladeta Jovovic, Mar 20 2001
Comments
Examples
References
Links