Solution (source code)

= Solution

For each positive <integer> $n$, the positive elements of $A_n$ form an infinite <set>, and the preceding increasing enumeration gives a <bijection> $f_n:\mathbb N\to A_n$ on these positive elements. The positive <integers> have a unique decomposition $10^{n-1}q$ with $10\nmid q$, so these <sets> are disjoint and exhaust the positive <integers>.

The printed <natural numbers> include $0$. The trailing-zero count of the representation of $0$ is not needed: shift the positive partition down by one and put
$$
\boxed{g(i,j)=f_{i+1}(j)-1,\qquad i,j\in\mathbb N.}
$$
Uniqueness of the trailing-zero count proves the <injective function> property, and the decomposition of $N+1$ proves the <surjective function> property. An explicit <decimal trailing-zero pairing function>, using the increasing enumeration from the previous part, is
$$
\boxed{g(i,j)=10^i\left(j+1+\left\lfloor\frac j9\right\rfloor\right)-1.}
$$
Indeed, the bracket enumerates $1,2,\ldots,9,11,12,\ldots$, exactly the positive <integers> not divisible by $10$. This handles both the positive index $n$ and the element $0$ without silently changing the PDF's convention.

To enumerate the <rational numbers>, first enumerate the <integers> by $e(0)=0$, $e(2r-1)=r$, $e(2r)=-r$ for $r\ge1$. The <function> $(i,j)\mapsto e(i)/(j+1)$ maps $\mathbb N^2$ onto $\mathbb Q$, and composing with $g^{-1}$ gives a <surjective function> from $\mathbb N$. Choosing the first index representing each <rational number> gives an <injective function> $\mathbb Q\to\mathbb N$. Thus \b[$\mathbb Q$ is countably infinite]; its infinitude follows because it contains all <integers>.