OFFSET
1,1
COMMENTS
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
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
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Paul Yiu, Recreational Mathematics, 24.3.1 Appendix: Two enumerations of the rational numbers in (0,1), page 633.
EXAMPLE
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]
-- Reinhard Zumkeller, Jul 29 2014
(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
William Rex Marshall, Dec 16 2010
STATUS
approved