cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A037161 Well-order the rational numbers; take numerators.

This page as a plain text file.
%I A037161 #14 Dec 20 2014 03:03:44
%S A037161 0,-1,1,-2,-1,1,2,-3,-1,1,3,-4,-3,-2,-1,1,2,3,4,-5,-1,1,5,-6,-5,-4,-3,
%T A037161 -2,-1,1,2,3,4,5,6,-7,-5,-3,-1,1,3,5,7,-8,-7,-5,-4,-2,-1,1,2,4,5,7,8,
%U A037161 -9,-7,-3,-1,1,3,7,9,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1
%N A037161 Well-order the rational numbers; take numerators.
%D A037161 W. Sierpiński, Cardinal and Ordinal Numbers, Warsaw 1965, 2nd ed., p. 40.
%H A037161 Reinhard Zumkeller, <a href="/A037161/b037161.txt">Table of n, a(n) for n = 0..10000</a>
%t A037161 order[n_] := Join[-Reverse[ pos = Select[(r = Range[n])/Reverse[r], Numerator[#] + Denominator[#] == n + 1 & ] ], pos]; order[0] = 0; Numerator[ Flatten[ Table[ order[n], {n, 0, 10}]]] (* _Jean-François Alcover_, Jun 27 2012 *)
%o A037161 (Haskell)
%o A037161 import Data.List (transpose)
%o A037161 import Data.Ratio ((%), numerator)
%o A037161 a037161 n = a037161_list !! n
%o A037161 a037161_list = 0 : map numerator
%o A037161   (concat $ concat $ transpose [map (map negate) qss, map reverse qss])
%o A037161   where qss = map q [1..]
%o A037161         q x = map (uncurry (%)) $ filter ((== 1) . uncurry gcd) $
%o A037161                   zip (reverse zs) zs where zs = [1..x]
%o A037161 -- _Reinhard Zumkeller_, Mar 08 2013
%Y A037161 Cf. A037162.
%Y A037161 Cf. A020652.
%K A037161 sign,easy,nice,frac
%O A037161 0,4
%A A037161 _N. J. A. Sloane_