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.
%I A182973 #43 Aug 26 2024 11:42:18 %S A182973 2,3,4,3,5,6,5,4,7,5,8,7,5,9,7,10,9,8,7,6,11,7,12,11,10,9,8,7,13,11,9, %T A182973 14,13,11,8,15,13,11,9,16,15,14,13,12,11,10,9,17,13,11,18,17,16,15,14, %U A182973 13,12,11,10,19,17,13,11,20,19,17,16,13,11,21,19,17,15,13,22,21,20,19,18,17,16,15,14,13,12 %N A182973 Denominators of positive rationals < 1 arranged by increasing sum of numerator and denominator then by increasing numerator. %C A182973 A023022(n) and A245678(n) give number and denominator of sum of fractions A182972(k)/a(k) such that A182972(k) + a(k) = n. - _Reinhard Zumkeller_, Jul 30 2014 %D A182973 S. Cook, Problem 511: An Enumeration Problem, Journal of Recreational Mathematics, Vol. 9:2 (1976-77), 137. Solution by the Problem Editor, JRM, Vol. 10:2 (1977-78), 122-123. %D A182973 R. K. Guy, Unsolved Problems in Number Theory (UPINT), Section D11. %H A182973 Reinhard Zumkeller, <a href="/A182973/b182973.txt">Table of n, a(n) for n = 1..10000</a> %H A182973 Paul Yiu, <a href="https://web.archive.org/web/20220720212753/http://math.fau.edu/Yiu/RecreationalMathematics2003.pdf">Recreational Mathematics</a>, 24.3.1 Appendix: Two enumerations of the rational numbers in (0,1), page 633. %H A182973 <a href="/index/Ra#rational">Index entries for sequences related to enumerating the rationals</a> %e A182973 Positive fractions < 1 listed by increasing sum of numerator and denominator, and by increasing numerator for equal sums: %e A182973 1/2, 1/3, 1/4, 2/3, 1/5, 1/6, 2/5, 3/4, 1/7, 3/5, 1/8, 2/7, 4/5, 1/9, 3/7, ... %e A182973 (this is A182972/A182973). %t A182973 A182973list[s_] := Table[If[CoprimeQ[num, s-num], s-num, Nothing], {num, Floor[s/2]}]; Flatten[Array[A182973list, 25, 3]] (* _Paolo Xausa_, Feb 27 2024 *) %o A182973 (Pascal) program a182973; %o A182973 var %o A182973 num,den,n: longint; %o A182973 function gcd(i,j: longint):longint; %o A182973 begin %o A182973 repeat %o A182973 if i>j then i:=i mod j else j:=j mod i; %o A182973 until (i=0) or (j=0); %o A182973 if i=0 then gcd:=j else gcd:=i; %o A182973 end; %o A182973 begin %o A182973 num:=1; den:=1; n:=0; %o A182973 repeat %o A182973 repeat %o A182973 inc(num); dec(den); %o A182973 if num>=den then %o A182973 begin %o A182973 inc(den,num); num:=1; %o A182973 end; %o A182973 until gcd(num,den)=1; %o A182973 inc(n); writeln(n,' ',den); %o A182973 until n=100000; %o A182973 end. %o A182973 (Haskell) %o A182973 a182973 n = a182973_list !! (n-1) %o A182973 a182973_list = map snd $ concatMap q [3..] where %o A182973 q x = [(num, den) | num <- [1 .. div x 2], %o A182973 let den = x - num, gcd num den == 1] %o A182973 -- _Reinhard Zumkeller_, Jul 29 2014 %o A182973 (Python) %o A182973 from itertools import count, islice %o A182973 from math import gcd %o A182973 def A182973_gen(): # generator of terms %o A182973 return (n-i for n in count(2) for i in range(1,1+(n-1>>1)) if gcd(i,n-i)==1) %o A182973 A182973_list = list(islice(A182973_gen(),10)) # _Chai Wah Wu_, Aug 28 2023 %Y A182973 Cf. A182972 (numerators), A366191 (interleaved). %Y A182973 Cf. A020652, A038567, A182974-A182976. %Y A182973 Cf. A023022, A245677, A245678, A245718. %K A182973 nonn,easy,frac,nice %O A182973 1,1 %A A182973 _William Rex Marshall_, Dec 16 2010