cp's OEIS Frontend

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.

A352911 Cantor's List: Pairs (i, j) of relatively prime positive integers sorted first by i + j then by i.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 4, 2, 3, 3, 2, 4, 1, 1, 5, 5, 1, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 1, 7, 3, 5, 5, 3, 7, 1, 1, 8, 2, 7, 4, 5, 5, 4, 7, 2, 8, 1, 1, 9, 3, 7, 7, 3, 9, 1, 1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 1, 11, 5, 7, 7, 5, 11, 1
Offset: 1

Views

Author

N. J. A. Sloane, Apr 09 2022

Keywords

Comments

a(2*n-1) / a(2*n) is the n-th fraction in Cantor's enumeration of the positive rational numbers. - Peter Luschny, Oct 10 2023

Examples

			The first few pairs are, seen as an irregular triangle:
  [1, 1],
  [1, 2], [2, 1],
  [1, 3], [3, 1],
  [1, 4], [2, 3], [3, 2], [4, 1],
  [1, 5], [5, 1],
  [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1],
  [1, 7], [3, 5], [5, 3], [7, 1],
  [1, 8], [2, 7], [4, 5], [5, 4], [7, 2], [8, 1],
  [1, 9], [3, 7], [7, 3], [9, 1],
  ...
		

Crossrefs

Cf. A352909, A020652 or A038566 (i-coordinates), A020653 (j-coordinates), A366191.

Programs

  • Maple
    CantorsList := proc(upto) local C, F, n, t, count;
    C := NULL; count := 0:
    for n from 2 while count < upto do
        F := select(t -> igcd(t, n-t) = 1, [$1..n-1]);
        C := C, seq([t, n - t], t = F);
        count := count + nops(F) od:
    ListTools:-Flatten([C]) end:
    CantorsList(40);  # Peter Luschny, Oct 10 2023
  • Mathematica
    A352911row[n_]:=Select[Array[{#,n-#}&,n-1],CoprimeQ[First[#],Last[#]]&];
    Array[A352911row,10,2] (* Generates 10 rows *) (* Paolo Xausa, Oct 10 2023 *)
  • Python
    from math import gcd
    from itertools import chain, count, islice
    def A352911_gen(): # generator of terms
        return chain.from_iterable((i,n-i) for n in count(2) for i in range(1,n) if gcd(i,n-i)==1)
    A352911_list = list(islice(A352911_gen(),30)) # Chai Wah Wu, Oct 10 2023