login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A020650 Numerators in recursive bijection from positive integers to positive rationals (the bijection is f(1) = 1, f(2n) = f(n)+1, f(2n+1) = 1/(f(n)+1)). 19

%I #66 Oct 14 2023 23:47:27

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

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

%U 7,1,7,6,11,5,11,6,13,4,13,9,14,5,14,9,13,3,13,10,17,7,17,10,15,4,15,11,18,7,18

%N Numerators in recursive bijection from positive integers to positive rationals (the bijection is f(1) = 1, f(2n) = f(n)+1, f(2n+1) = 1/(f(n)+1)).

%C The fractions are given in their reduced form, thus gcd(a(n), A020651(n)) = 1 for all n. - _Antti Karttunen_, May 26 2004

%C From _Yosu Yurramendi_, Jul 13 2014 : (Start)

%C If the terms (n>0) are written as an array (left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...

%C 1,

%C 2,1,

%C 3,1,3,2,

%C 4,1,4,3,5,2,5,3,

%C 5,1,5,4,7,3,7,4, 7,2, 7,5, 8,3, 8,5,

%C 6,1,6,5,9,4,9,5,10,3,10,7,11,4,11,7,9,2,9,7,12,5,12,7,11,3,11,8,13,5,13,8,

%C then the sum of the m-th row is 3^m (m = 0,1,2,), and each column is an arithmetic sequence.

%C If the rows are written in a right-aligned fashion:

%C 1,

%C 2,1,

%C 3,1, 3,2,

%C 4,1, 4,3, 5,2, 5,3,

%C 5,1,5,4, 7,3, 7,4, 7,2, 7,5, 8,3, 8,5,

%C 6,1,6,5,9,4,9,5,10,3,10,7,11,4,11,7,9,2,9,7,12,5,12,7,11,3,11,8,13,5,13,8,

%C each column k is a Fibonacci sequence. (End)

%C a(n2^m+1) = a(2n+1), n > 0, m > 0. - _Yosu Yurramendi_, Jun 04 2016

%H T. D. Noe, <a href="/A020650/b020650.txt">Table of n, a(n) for n = 1..10000</a>

%H D. N. Andreev, <a href="http://www.mathnet.ru/eng/mp12">On a Wonderful Numbering of Positive Rational Numbers</a>, Matematicheskoe Prosveshchenie, Series 3, volume 1, 1997, pages 126-134 (in Russian). a(n) = numerator of r(n).

%H Shen Yu-Ting, <a href="https://doi.org/10.2307/2320374">A Natural Enumeration of Non-Negative Rational Numbers -- An Informal Discussion</a>, American Mathematical Monthly, volume 87, number 1, January 1980, pages 25-29. a(n) = numerator of gamma_n.

%H <a href="/index/Fo#fraction_trees">Index entries for fraction trees</a>

%F a(1) = 1, a(2n) = a(n) + A020651(n), a(2n+1) = A020651(2n) = A020651(n). - _Antti Karttunen_, May 26 2004

%F a(2n) = A020651(2n+1). - _Yosu Yurramendi_, Jul 17 2014

%F a((2*n+1)*2^m + 1) = A086592(n), n > 0, m > 0. For n = 0, A086592(0) = 1 is needed. For m = 0, a((2*(n+1)) = A086592(n+1). - _Yosu Yurramendi_, Feb 19 2017

%F a(n) = A002487(1+A231551(n)), n > 0. - _Yosu Yurramendi_, Aug 07 2021

%e 1, 2, 1/2, 3, 1/3, 3/2, 2/3, 4, 1/4, 4/3, ...

%p A020650 := n -> `if`((n < 2),n, `if`(type(n,even), A020650(n/2)+A020651(n/2), A020651(n-1)));

%t f[1] = 1; f[n_?EvenQ] := f[n] = f[n/2]+1; f[n_?OddQ] := f[n] = 1/(f[(n-1)/2]+1); a[n_] := Numerator[f[n]]; Table[a[n], {n, 1, 94}] (* _Jean-François Alcover_, Nov 22 2011 *)

%t a[1]=1; a[2]=2; a[3]=1; a[n_] := a[n] = Switch[Mod[n, 4], 0, a[n/2+1] + a[n/2], 1, a[(n-1)/2+1], 2, a[(n-2)/2+1] + a[(n-2)/2], 3, a[(n-3)/2]]; Array[a, 100] (* _Jean-François Alcover_, Jan 22 2016, after _Yosu Yurramendi_ *)

%o (Haskell)

%o import Data.List (transpose); import Data.Ratio (numerator)

%o a020650_list = map numerator ks where

%o ks = 1 : concat (transpose [map (+ 1) ks, map (recip . (+ 1)) ks])

%o -- _Reinhard Zumkeller_, Feb 22 2014

%o (R)

%o N <- 25 # arbitrary

%o a <- c(1,2,1)

%o for(n in 1:N){

%o a[4*n] <- a[2*n] + a[2*n+1]

%o a[4*n+1] <- a[2*n+1]

%o a[4*n+2] <- a[2*n] + a[2*n+1]

%o a[4*n+3] <- a[2*n]

%o }

%o a

%o # _Yosu Yurramendi_, Jul 13 2014

%o (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, y])); x \\ _Mikhail Kurkov_, Oct 12 2023

%Y Cf. A020651.

%Y Bisection: A086592.

%K nonn,easy,frac,nice

%O 1,2

%A _David W. Wilson_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 15:38 EDT 2024. Contains 371254 sequences. (Running on oeis4.)