

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)).


6



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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

The fractions are given in their reduced form, thus gcd(a(n), A020651(n)) = 1 for all n.  Antti Karttunen, May 26 2004


LINKS

T. D. Noe, Table of n, a(n) for n=1..10000


FORMULA

a(1) = 1, a(2n) = a(n)+A020651(n), a(2n+1) = A020651(2n) = A020651(n)  Antti Karttunen, May 26 2004


EXAMPLE

1, 2, 1/2, 3, 1/3, 3/2, 2/3, 4, 1/4, 4/3, ...


MAPLE

A020650 := n > `if`((n < 2), n, `if`(type(n, even), A020650(n/2)+A020651(n/2), A020651(n1)));


MATHEMATICA

f[1] = 1; f[n_?EvenQ] := f[n] = f[n/2]+1; f[n_?OddQ] := f[n] = 1/(f[(n1)/2]+1); a[n_] := Numerator[f[n]]; Table[a[n], {n, 1, 94}] (* JeanFrançois Alcover, Nov 22 2011 *)


PROG

(Haskell)
import Data.List (transpose); import Data.Ratio (numerator)
a020650_list = map numerator ks where
ks = 1 : concat (transpose [map (+ 1) ks, map (recip . (+ 1)) ks])
 Reinhard Zumkeller, Feb 22 2014


CROSSREFS

Cf. A020651.
Bisection: A086592.
Sequence in context: A144079 A071575 A038569 * A124224 A014599 A075825
Adjacent sequences: A020647 A020648 A020649 * A020651 A020652 A020653


KEYWORD

nonn,easy,frac,nice


AUTHOR

David W. Wilson


STATUS

approved



