lattice : hypervolume and its associated hypersurface Imagine I have a lattice with a point every one unit length in each direction.
I'm interested in knowing how many points I have on the border (hypersurface)
in any $D$ dimension.


*

*$1D$ for a length $L$, I have $L$ points.

*$2D$ for a square of side $L$, I have $4L-4$ because the corners should not
be counted twice 

*$3D$ for a cube of side $L$, I have $6L^2-12L+8$ because the edges should not
be counted twice and the corners should not be forgotten.

*$4D$ for a tesseract, I have $8L^3-24L^2+32L-16$ for the same reasons


The coefficient I used are given for instance by wikipedia.
Now I want two have a general formula that does the same for a hyperrectangle.


*

*$2D$ for a rectangle of side $L_x Ly$, I have $2(L_x+L_y)-4$

*$3D$ for edges of length $L_x,L_y,L_z$, the number of points on the surface
is given by $2(L_xL_y +LxL_z+L_yL_z)- 4(L_x+Ly+L_z)+8$

*$4D$ for with $L_w,L_x,L_y,L_z$, I have
$2(L_wL_xL_y+L_wL_xL_z+L_wL_yL_z+L_xL_yL_z)
  -4(L_wL_x+L_wL_y+L_wL_z+L_xL_y+L_xL_z+L_yL_z)+4(L_w+L_x+L_y+L_z)-16$ 


I didn't prove the formula for $4D$ but to find the coefficient I assumed that
when $L_w=L_x=L_y=L_z$ I should recover the formula for the tesseract. Is it
safe to assume that for $ND$, the formula of the hyperrectangle will be
something like: 
$$ \sum_{i=0}^{D-1}(-1)^i \frac{a_i}{N_i}\sum_{P_i} \prod_{\alpha} L_{P_i(\alpha)} $$
where $P_i$ is all the possible permutations of $i$ terms, $N_i$ is the number
of permutations and $a_i$ is the coefficient for the hypercube.
Is my intuition correct ?

I think that the formula I gave is correct.  I did some numerical test for
different dimensions and I was able to recover the correct number of points on
the ($N-1$)surface.
