login
Enumeration of the rational numbers in the closed real interval [0, 1] after Cantor.
5

%I #23 Feb 27 2024 06:17:21

%S 0,1,1,1,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,

%T 1,10,2,9,3,8,4,7,5,6,1,11,5,7,1,12,2,11,3,10,4,9,5,8,6,7,1,13,3,11,5,

%U 9,1,14,2,13,4,11,7,8,1,15,3,13,5,11,7,9

%N Enumeration of the rational numbers in the closed real interval [0, 1] after Cantor.

%C The rational numbers in the interval [0, 1] are listed as pairs of relatively prime integers a(2*n-1) / a(2*n).

%C Start with (0, 1). Then append pairs (t, n - t) where t and n - t are relatively prime positive integers and 1 <= t <= floor(n/2). Sort first by n then by t in ascending order.

%H Paolo Xausa, <a href="/A366191/b366191.txt">Table of n, a(n) for n = 1..12234</a>

%H Georg Cantor, <a href="http://gdz.sub.uni-goettingen.de/dms/resolveppn/?PPN=GDZPPN002156806">Ein Beitrag zur Mannigfaltigkeitslehre</a>, Journal für die reine und angewandte Mathematik 84 (1878), 242-258, (p. 250).

%H <a href="/index/Ra#rational">Index entries for sequences related to enumerating the rationals</a>

%e Seen as an irregular table:

%e 1: [0, 1],

%e 2: [1, 1],

%e 3: [1, 2],

%e 4: [1, 3],

%e 5: [1, 4], [2, 3],

%e 6: [1, 5],

%e 7: [1, 6], [2, 5], [3, 4],

%e 8: [1, 7], [3, 5],

%e 9: [1, 8], [2, 7], [4, 5],

%e 10: [1, 9], [3, 7],

%e 11: [1, 10], [2, 9], [3, 8], [4, 7], [5, 6],

%e ...

%p A366191List := proc(upto) local C, F, n, t, count;

%p C := [0, 1]; count := 0:

%p for n from 2 while count < upto do

%p F := select(t -> igcd(t, n - t) = 1, [$1..iquo(n,2)]);

%p C := C, seq([t, n - t], t = F);

%p count := count + nops(F) od;

%p ListTools:-Flatten([C]) end:

%p A366191List(40);

%t A366191row[n_] := If[n == 1, {0, 1}, Select[Array[{#, n - #}&, Floor[n/2]], CoprimeQ[First[#], Last[#]]&]];

%t Array[A366191row, 20] (* _Paolo Xausa_, Jan 16 2024 *)

%Y Cf. A352911, A333856 (numerators only).

%Y Essentially, A182972/A182973 give the numerators/denominators separately.

%K nonn,easy,tabf

%O 1,6

%A _Peter Luschny_, Oct 10 2023