A245327 Numerators in recursive bijection from positive integers to positive rationals, where the bijection is f(1) = 1, f(2n) = 1/(f(n)+1), f(2n+1) = f(n)+1.
1, 1, 2, 2, 3, 1, 3, 3, 5, 2, 5, 3, 4, 1, 4, 5, 8, 3, 8, 5, 7, 2, 7, 4, 7, 3, 7, 4, 5, 1, 5, 8, 13, 5, 13, 8, 11, 3, 11, 7, 12, 5, 12, 7, 9, 2, 9, 7, 11, 4, 11, 7, 10, 3, 10, 5, 9, 4, 9, 5, 6, 1, 6, 13, 21, 8, 21, 13, 18, 5, 18, 11, 19, 8, 19, 11, 14, 3, 14, 12, 19, 7, 19, 12, 17, 5, 17, 9, 16, 7, 16, 9, 11, 2, 11, 11, 18, 7, 18, 11
Offset: 1
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..16383, rows 1-14, flattened.
- Index entries for fraction trees
Programs
-
Mathematica
f[n_] := Which[n == 1, 1, EvenQ@ n, 1/(f[n/2] + 1), True, f[(n - 1)/2] + 1]; Table[Numerator@ f@ k, {n, 7}, {k, 2^(n - 1), 2^n - 1}] // Flatten (* Michael De Vlieger, Mar 02 2017 *)
-
PARI
a(n) = my(A=0); forstep(i=logint(n, 2), 0, -1, if(bittest(n, i), A++, A=1/(A+1))); numerator(A) \\ Mikhail Kurkov, Mar 12 2023
-
R
N <- 25 # arbitrary a <- c(1,1,2) for(n in 1:N){ a[4*n] <- a[2*n+1] a[4*n+1] <- a[2*n] + a[2*n+1] a[4*n+2] <- a[2*n] a[4*n+3] <- a[2*n] + a[2*n+1] } a
Formula
a((2*n+1)*2^m - 2) = A273493(n), n > 0, m > 0. For n = 0, m > 0, A273493(0) = 1 is needed. For n = 1, m = 0, A273493(0) = 1 is needed. For n > 1, m = 0, numerator((2*n-1) = num+den(n-1). - Yosu Yurramendi, Mar 02 2017
Comments