|
|
A182973
|
|
Denominators of positive rationals < 1 arranged by increasing sum of numerator and denominator then by increasing numerator.
|
|
13
|
|
|
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, 14, 13, 11, 8, 15, 13, 11, 9, 16, 15, 14, 13, 12, 11, 10, 9, 17, 13, 11, 18, 17, 16, 15, 14, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
REFERENCES
|
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.
R. K. Guy, Unsolved Problems in Number Theory (UPINT), Section D11.
|
|
LINKS
|
|
|
EXAMPLE
|
Positive fractions < 1 listed by increasing sum of numerator and denominator, and by increasing numerator for equal sums:
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, ...
|
|
MATHEMATICA
|
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 *)
|
|
PROG
|
(Pascal) program a182973;
var
num, den, n: longint;
function gcd(i, j: longint):longint;
begin
repeat
if i>j then i:=i mod j else j:=j mod i;
until (i=0) or (j=0);
if i=0 then gcd:=j else gcd:=i;
end;
begin
num:=1; den:=1; n:=0;
repeat
repeat
inc(num); dec(den);
if num>=den then
begin
inc(den, num); num:=1;
end;
until gcd(num, den)=1;
inc(n); writeln(n, ' ', den);
until n=100000;
end.
(Haskell)
a182973 n = a182973_list !! (n-1)
a182973_list = map snd $ concatMap q [3..] where
q x = [(num, den) | num <- [1 .. div x 2],
let den = x - num, gcd num den == 1]
(Python)
from itertools import count, islice
from math import gcd
def A182973_gen(): # generator of terms
return (n-i for n in count(2) for i in range(1, 1+(n-1>>1)) if gcd(i, n-i)==1)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy,frac,nice
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|