How to put N=n^3+b points into 3 dimensional space?

Suppose I want to create a "wrapped", discrete space. If it would be a

1 dimensional space, then for 5 points, the space would be something

like: x = t mod 5. For two dimensional space, I would have x = t mod

5, y = u mod 5.

This is similar to the Mobius strip "wrapness", IMHO. The "wrap"

operation does not have to be the modulo, maybe there is a more

correct way from math point of view.

So, finally suppose that I want to create something, that is a 3

dimensional wrapped space with N points and that N is not a smooth a^3

number (it is for example: a^3+b, `a' and `b' being positive integers,

and a^3+b <> c^3). How to generalize such space so that it would keep

regular 3 dimensional space properties?

In other words, if I have 27 symmetric "boxes" (small cubes), I can

put it into bigger cube, and address them with x,y,z coordinates and

everything works smoothly. But what if I have 29 "boxes" and still want

to use 3 dimensional discrete space? Can I somehow generalize the large

cube so that the "smoothness" would be preserved, i.e. the two cubes

(with 27 and 29 elements) would work according to the same rules?