A162911 Numerators of drib tree fractions, where drib is the bit-reversal permutation tree of the Bird tree.
1, 1, 2, 2, 3, 1, 3, 3, 5, 1, 4, 3, 4, 2, 5, 5, 8, 2, 7, 4, 5, 3, 7, 4, 7, 1, 5, 5, 7, 3, 8, 8, 13, 3, 11, 7, 9, 5, 12, 5, 9, 1, 6, 7, 10, 4, 11, 7, 11, 3, 10, 5, 6, 4, 9, 7, 12, 2, 9, 8, 11, 5, 13, 13, 21, 5, 18, 11, 14, 8, 19, 9, 16, 2, 11, 12, 17, 7, 19, 9, 14, 4, 13, 6, 7, 5, 11, 10, 17, 3, 13
Offset: 1
Examples
The first four levels of the drib tree: [1/1], [1/2, 2/1], [2/3, 3/1, 1/3, 3/2], [3/5, 5/2, 1/4, 4/3, 3/4, 4/1, 2/5, 5/3].
Links
- Ralf Hinze, Functional pearls: the bird tree, J. Funct. Programming 19 (2009), no. 5, 491-508.
- Index entries for fraction trees
Crossrefs
Programs
-
Haskell
import Ratio; drib :: [Rational]; drib = 1 : map (recip . succ) drib \/ map (succ . recip) drib; (a : as) \/ bs = a : (bs \/ as); a162911 = map numerator drib; a162912 = map denominator drib
-
PARI
a(n) = my(x = 0, y = 1); forstep(i = logint(n, 2), 0, -1, [x, y] = if(bittest(n, i), [y, x + y], [x + y, x])); y \\ Mikhail Kurkov, Oct 12 2023
-
R
blocklevel <- 6 # arbitrary a <- 1 for(m in 0:blocklevel) for(k in 0:(2^m-1)){ a[2^(m+1)+2*k ] <- a[2^(m+1)-1-k] a[2^(m+1)+2*k+1] <- a[2^(m+1)-1-k] + a[2^m+k] } a # Yosu Yurramendi, Jul 11 2014
Formula
a(n) where a(1) = 1; a(2n) = b(n); a(2n+1) = a(n) + b(n); and b(1) = 1; b(2n) = a(n) + b(n); b(2n+1) = a(n).
a(2^(m+1)+2*k) = a(2^(m+1)-k-1), a(2^(m+1)+2*k+1) = a(2^(m+1)-k-1) + a(2^m+k), a(1) = 1, m>=0, k=0..2^m-1. - Yosu Yurramendi, Jul 11 2014
a(2^(m+1) + 2*k) = A162912(2^m + k), m >= 0, 0 <= k < 2^m.
a(2^(m+1) + 2*k + 1) = a(2^m + k) + A162912(2^m + k), m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Mar 30 2016
Comments