A counting problem in the sets of dyadic numbers in $[0,1)^n$. This  is just a line that came up in a construction of Brownian path that I dont understand .
Soe let $N_0$ be the set of naturals including 0, i.e. $N_0=\{0,1,2,\dots\}$ and $D_m:=2^{-m}N_0^n \cap [0,1)^n$. Then $D=\cup_m D_m$ are the dyadic numbers in $[0,1)^n.$ Set
$$\Delta_m:=\{(x,y)\in D_m \times D_m : |x-y|_\infty \le 2^{-m}\}, $$where $|x-y|_\infty = \max_{1\le k \le n}|x^k -y^k|. $
Under this setting, why does each $x\in D_m$ have at most $3^n-1$ nearest neighbors in $D_m$ and the set $\Delta_m $ contains no more than $3^n 2^{mn}$ elements?
 A: *

*Nearest Neighbours of an $x\in D_m$.

In dimension $n=2$, if we imagine an infinite grid of sidelengths $2^{-m}$ the following $y$s are the unique points solving $|x-y|_\infty=2^{-m}$, i.e. they are the nearest neighbours:
   yyy
...yxy...
   yyy

That is, they are all the points in a $3\times 3$ box, minus the one point in the middle. Similarly for $n>2$: count the number of points in the box of uniform sidelength $3$, and subtract the middle point. When considering $x\in D_m$, there are edgecases (literally, on the edge of $D_m$) where there are less neighbours.

*

*Size of $\Delta_m$.

We count an upper bound by viewing $x$ as an arbitrary element of $D_m$, and then asking $y$ to be a nearest neighbour of such an $x$, or equal to $x$ itself. The number of such $y$s is $\le3^n$ as previously discussed. The number of $x$s is $2^{mn}$.
To see this, consider first $n=1$, with corresponding $D_{m,n} = D_{m,1}=(2^{-m}N_0)\cap [0,1)$. Obviously, this set is a rescaling  of $\{0,1,\dots,2^m-1\}$. That is, $k2^{-m} \in D_{m,1}$ if $k2^{-m} < 1$ i.e. $k<2^m$. There are precisely $2^m$ such $k\in N_0$. For $n>1$, $D_m=D_{m,n}=D_{m,1}^n$ is a product set; indeed, since product sets scale via $\lambda(A\times B) = (\lambda A) \times (\lambda B)$, we have
$$ D_m = (2^{-m} N_0^n) \cap [0,1)^n = (2^{-m} N_0)^n \cap [0,1)^n = ((2^{-m} N_0)\cap [0,1))^n = D_{m,1}^n.$$
So $|D_m|=|D_{m,1}|^n = 2^{mn}$.
Therefore, the number of elements in $\Delta_m$ is at most the product $3^n 2^{mn}$.
