3 ms·
for a in range(1, Infinity): for b in range(a): print(a-b, "/" , b+1) Will print out: 1/1, 2/1, 1/2, 3/1, 2/2, 1/3, 4/1, 3/2, 2/3, 1/4,
by gwf 5y ago
for a in range(1, Infinity):
for b in range(a):
print(a-b, "/" , b+1)
Will print out:
1/1, 2/1, 1/2, 3/1, 2/2, 1/3, 4/1, 3/2, 2/3, 1/4, ...
Hence, we've just mapped all rationals (with duplicates) to a single linear list. Since any linear list can always be mapped to the naturals (1, 2, 3, ...), they have the same cardinality.
QED