A bijection from ℕ onto ℕxℕ.

The next formula gives an explicit form of  the "repeat sequence".

Clear[r, n];
r[n_] := Floor[(Sqrt[2 n]) + (1/2)]

Table[r[n], {n, 1, 50}]

The following formula defines the sequence of triangular numbers.

Clear[T, n];
T[n_] := (1/2) n (n + 1)

Table[T[n], {n, 0, 50}]

Now, we can give an explicit formula for a surjection from ℕ onto ℕxℕ.

Clear[n, B];
B[n_] := {(n - T[r[n] - 1]), (T[r[n]] - n + 1)}

This is the table of the first 100 values:

B[1000000]

Table[B[k], {k, 1, 100}]

The inverse of the function B[n] is the following function

Clear[A, s, t];

    
A[{s_, t_}] := (((s + t - 2) (s + t - 1))/2) + s

To illustrate that the functions B[n] and  A[{s, t}] are inverses of each other calculate

A[B[12]]

A[{1009, 406}]

B[A[{134, 216}]]

Or, many values in a table

Table[{k, A[B[k]]}, {k, 1, 100}]

Flatten[Table[Table[{{s, t}, B[A[{s, t}]]}, {s, 1, 2}], {t, 1, 20}], 
      1]

The following two functions will help illustrate how listing of points in ℕxℕ works in the coordinate system.

Clear[Illustrate, Illustrate1, Illustrate2, s, t, m, 
        n];

    
Illustrate[m_, n_] := 
        Graphics[{
{Thickness[0.004], 
              GrayLevel[
                0.7], {Line[{{#, -1}, {#, 100}}], 
                    Line[{{-1, #}, {100, #}}]} & /@ 
                Range[0, 30]}, 
{PointSize[
                0.04], Point[B[#]] & /@ 
                Range[1, 
                  n]}, 
{Text[A[B[#]], B[#], 
                    TextStyle -> {FontSize -> 7, 
                        FontColor -> White, 
                        FontWeight -> "Bold"}]} & /@ 
              Range[1, m]
}];

    
\(\(\(Illustrate1[n_] := 
        Graphics[{
{Thickness[0.004], 
              GrayLevel[
                0.7], \({Line[{{#, \(-1\)}, {#, 100}}], 
                    Line[{{\(-1\), #}, {100, #}}]} &\) /@ 
                Range[0, 30]}, 
{PointSize[0.04], 
              Point[B[n]]}, 
{Text[A[B[n]], B[n], 
                TextStyle -> {FontSize -> 7, 
                    FontColor -> White, 
                    FontWeight -> "Bold"}]}
}];\)\(
\)
    \)\)
Illustrate2[{s_, t_}] := 
      Graphics[{
{Thickness[0.004], 
            GrayLevel[
              0.7], {Line[{{#, -1}, {#, 100}}], 
                  Line[{{-1, #}, {100, #}}]} & /@ 
              Range[0, 30]}, 
{PointSize[0.04], 
            Point[{s, t}]}, 
{Text[A[{s, t}], {s, t}, 
              TextStyle -> {FontSize -> 7, FontColor -> White, 
                  FontWeight -> "Bold"}]}
}]

Show[
Illustrate1[
          216], 
PlotRange -> {{0.5, 20.5}, {0.5, 
              20.5}}, Frame ->  True, AspectRatio -> Automatic, 
        ImageSize -> 350, 
        FrameTicks -> {Range[1, 20], 
            Range[1, 20], {}, {}}
];

Show[
Illustrate2[{6, 
            14}], 
PlotRange -> {{0.5, 20.5}, {0.5, 
              20.5}}, Frame ->  True, AspectRatio -> Automatic, 
        ImageSize -> 350, 
        FrameTicks -> {Range[1, 20], 
            Range[1, 20], {}, {}}
];

Show[
Illustrate1[
          177], 
PlotRange -> {{0.5, 20}, {0.5, 20}}, 
        Frame ->  True, AspectRatio -> Automatic, 
        ImageSize -> 350, 
        FrameTicks -> {Range[1, 20], 
            Range[1, 20], {}, {}}
];

Now the animation of listing of the first two hundred points

Table[
        Show[
Illustrate[n, 
            n], 
PlotRange -> {{0.5, 20.5}, {0.5, 
                20.5}}, Frame ->  True, AspectRatio -> Automatic, 
          ImageSize -> 350, 
          FrameTicks -> {Range[1, 20], 
              Range[1, 20], {}, {}}
], {n, 1, 
          200}];

Show[
Illustrate[685, 
          685], 
PlotRange -> {{0.5, 20.5}, {0.5, 
              20.5}}, Frame ->  True, AspectRatio -> Automatic, 
        ImageSize -> 350, 
        FrameTicks -> {Range[1, 20], 
            Range[1, 20], {}, {}}
];