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 A182972 #47 Aug 26 2024 11:42:13 %S A182972 1,1,1,2,1,1,2,3,1,3,1,2,4,1,3,1,2,3,4,5,1,5,1,2,3,4,5,6,1,3,5,1,2,4, %T A182972 7,1,3,5,7,1,2,3,4,5,6,7,8,1,5,7,1,2,3,4,5,6,7,8,9,1,3,7,9,1,2,4,5,8, %U A182972 10,1,3,5,7,9,1,2,3,4,5,6,7,8,9,10,11,1,5,7,11,1,2,3,4,6,7,8,9,11,12,1,3,5,7,9,11 %N A182972 Numerators of positive rationals < 1 arranged by increasing sum of numerator and denominator then by increasing numerator. %C A182972 A023022(n) and A245677(n) give number and numerator of sum of fractions a(k)/A182973(k) such that a(k) + A182973(k) = n. - _Reinhard Zumkeller_, Jul 30 2014 %D A182972 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 A182972 R. K. Guy, Unsolved Problems in Number Theory (UPINT), Section D11. %H A182972 Reinhard Zumkeller, <a href="/A182972/b182972.txt">Table of n, a(n) for n = 1..10000</a> %H A182972 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 A182972 <a href="/index/Ra#rational">Index entries for sequences related to enumerating the rationals</a> %e A182972 Positive fractions < 1 listed by increasing sum of numerator and denominator, and by increasing numerator for equal sums: %e A182972 1/2 %e A182972 1/3 %e A182972 1/4 2/3 %e A182972 1/5 %e A182972 1/6 2/5 3/4 %e A182972 1/7 3/5 %e A182972 1/8 2/7 4/5 %e A182972 1/9 3/7 %e A182972 1/10 2/9 3/8 4/7 5/6 %e A182972 1/11 5/7 %e A182972 1/12 2/11 3/10 4/9 5/8 6/7 %e A182972 1/13 3/11 5/9 %e A182972 1/14 2/13 4/11 7/8 %e A182972 1/15 3/13 5/11 7/9 %e A182972 1/16 2/15 3/14 4/13 5/12 6/11 7/10 8/9 %e A182972 1/17 5/13 7/11 %e A182972 1/18 2/17 3/16 4/15 5/14 6/13 7/12 8/11 9/10 %e A182972 1/19 3/17 7/13 9/11 %e A182972 (this is A182972/A182973). %p A182972 t1:=[]; %p A182972 for n from 2 to 40 do %p A182972 t1:=[op(t1),1/(n-1)]; %p A182972 for i from 2 to floor((n-1)/2) do %p A182972 if gcd(i,n-i)=1 then t1:=[op(t1),i/(n-i)]; fi; od: %p A182972 od: %p A182972 t1; %t A182972 t1={}; For[n=2, n <= 40, n++, AppendTo[t1, 1/(n-1)]; For[i=2, i <= Floor[(n-1)/2], i++, If[GCD[i, n-i] == 1, AppendTo[t1, i/(n-i)]]]]; t1 // Numerator // Rest (* _Jean-François Alcover_, Jan 20 2015, translated from Maple *) %o A182972 (Pascal) program a182972; %o A182972 var %o A182972 num,den,n: longint; %o A182972 function gcd(i,j: longint):longint; %o A182972 begin %o A182972 repeat %o A182972 if i>j then i:=i mod j else j:=j mod i; %o A182972 until (i=0) or (j=0); %o A182972 if i=0 then gcd:=j else gcd:=i; %o A182972 end; %o A182972 begin %o A182972 num:=1; den:=1; n:=0; %o A182972 repeat %o A182972 repeat %o A182972 inc(num); dec(den); %o A182972 if num>=den then %o A182972 begin %o A182972 inc(den,num); num:=1; %o A182972 end; %o A182972 until gcd(num,den)=1; %o A182972 inc(n); writeln(n,' ',num); %o A182972 until n=100000; %o A182972 end. %o A182972 (Haskell) %o A182972 a182972 n = a182972_list !! (n-1) %o A182972 a182972_list = map fst $ concatMap q [3..] where %o A182972 q x = [(num, den) | num <- [1 .. div x 2], %o A182972 let den = x - num, gcd num den == 1] %o A182972 -- _Reinhard Zumkeller_, Jul 29 2014 %o A182972 (Python) %o A182972 from itertools import count, islice %o A182972 from math import gcd %o A182972 def A182972_gen(): # generator of terms %o A182972 return (i for n in count(2) for i in range(1,1+(n-1>>1)) if gcd(i,n-i)==1) %o A182972 A182972_list = list(islice(A182972_gen(),10)) # _Chai Wah Wu_, Aug 28 2023 %Y A182972 Cf. A182973 (denominators), A366191 (interleaved). %Y A182972 Cf. A020652, A038567, A182974, A182975, A182976. %Y A182972 Cf. A023022, A245677, A245678, A245718. %Y A182972 Essentially the same as A333856. %K A182972 nonn,easy,frac,nice %O A182972 1,4 %A A182972 _William Rex Marshall_, Dec 16 2010 %E A182972 Corrected by _William Rex Marshall_, Aug 12 2013