= Decimal trailing-zero pairing function
{title2=$g(i,j)=10^i(j+1+\lfloor j/9\rfloor)-1$}
The bracket enumerates the positive <integers> not divisible by $10$. Every positive <integer> has exactly one decomposition into a power of $10$ times such an integer, so this formula is a <bijection> from $\mathbb N^2$ to $\mathbb N$. Subtracting one in the codomain includes zero without requiring a trailing-zero convention for its decimal representation. For the inverse, write $N+1=10^i q$ with $10\nmid q$, then $j=q-1-\lfloor q/10\rfloor$.
Back to article page