TITLE: Building a cube from small bricks such that no lines can be pushed through between the seams
QUESTION [25 upvotes]: I'm riffing on an old contest training question I jousted with 40 years ago.
The original problem was:

A solid $20\times20\times20$ cube is built out rectangular bricks of dimensions $2\times2\times1$. Prove that it is possible to "push" a line through the cube in such a way that the line is not obstructed by any of the bricks.

Solution: We need $2000$ bricks to build this cube. Imagine that the edges of the cube align with the coordinate axes, and that the cube is in the first octant with one of its vertices at the origin. So there are $19^2$ lines parallel to the $z$-axis going through the cube, each given by the equations $x=a, y=b, a,b\in\{1,2,\ldots,19\}$, lines parametrized by the choice of the pair $(a,b)$. Similarly, there are $19^2$ lines parallel to the $x$ and $y$-axes for a total of $3\cdot19^2$ lines. It turns out that one of these will go through the cube along the cracks between the bricks.
The key observation is that each line will be blocked by an even number of bricks (spoiler hidden below in case you want to think about it yourself).

 Take one of those lines, say $z$ arbitrary, $x=a$, $y=b$. Consider the two planes, the first defined by $x=a$ and the second by $y=b$. These two planes cut the cube into four parts, the volume of each is an even integer. Then consider how the bricks are split by these two planes. We see that a brick blocks this line if and only if its volume is split equally between the four parts – an odd contribution to each part. The claim follows.

As $2\cdot3\cdot19^2>2000$ it is impossible that all these lines would be blocked by two or more bricks. Therefore at least one of them is unobstructed, proving the claim.
Ok, that was the background story. On with the actual question.
As the size of the cube, call it $n$, grows, the number of bricks increases as $n^3/4$, but the number of those lines, call them integer lines, increases as a quadratic polynomial of $n$ only. Therefore sooner rather than later the above argument fails to work. In fact, this happens already with $n=22$
as $2\cdot3\cdot21^2<22^3/4$. The parameters $a,b$ obviously ranging from $1$ to $n-1$.

Is it possible to build a solid $22\times22\times22$ cube out of $2\times2\times1$ bricks in such a way that all the integer lines are blocked by at least one (hence at least two) bricks? If this is not possible with $n=22$, what is the smallest value of $n$ for which this construction is possible (if one exists)?


Given that the answer to my question is unknown, I will welcome answers explaining a construction for answerer's choice of $n$.

REPLY [5 votes]: I've written a program which implements a random construction similar to the one from my other answer, and used this program to find a tiling which blocks all lines for the case $n = 102$.
Unfortunately this isn't very insightful -- the tiling is random and (essentially) unstructured, and doesn't give much information about the nature of the problem. I would be interested to see a construction which could be reasonably verified by a human; my post is mainly intended to gain a little closure and to nail down a reasonable upper bound.
Approach (similar to other answer):
Again, for convenience we want to think of the $n \times n \times n$ cube as a $k \times k \times k$ cube of $2 \times 2 \times 2$ subcubes (which I'll just refer to as "cubes"), with centers at points in $\{1, 3, 5, \dots, 2k-1\}^3$. The main benefit of this idea is that it allows for very modular construction, where we can place a given configuration of tiles locally (filling completely a small number of adjacent cubes) without worrying about how this will affect the global structure of the tiling.
The idea is to place, for each line, a small configuration of tiles which blocks the line. The configuration used depends on the parity of the coordinates of the line. Consider a line in the $z$-direction, given by the equations $x = a$ and $y = b$. For any such line, our configuration will be placed at some level $h$, for an odd $h$ between $1$ and $2k-1$. If $a$ and $b$ are both odd, we place the first configuration below in the cube with center $(a, b, h)$. If $a$ is odd and $b$ is even, we place the second configuration below in the adjacent cubes with centers $(a, b-1, h)$, $(a, b+1, h)$. Similarly, if $a$ is even and $b$ is odd, we place the second configuration in the adjacent cubes with centers $(a-1, b, h)$, $(a+1, b, h)$. Finally, if $a$ and $b$ are both even, we place the third configuration below in the adjacent cubes with centers $(a-1, b-1, h)$, $(a-1, b+1, h)$, $(a+1, b-1, h)$, $(a+1, b+1, h)$.

Hopefully the diagrams make clear that if placed as described, a configuration will block its associated line. Rotated versions of the above configurations can be placed analogously in order to block lines in the $x$- and $y$-directions. Once we've chosen a level for each line, our work is done so long as the tile configurations, when placed at the associated levels, don't overlap: after placing these configurations, no cubes are only partially filled, so we can fill all the empty cubes according to the first configuration above, yielding a full tiling of the $n \times n \times n$ cube. Thus to build a good tiling, it's enough to give a list of levels for all lines which produces no overlap.
Results:
I wrote a program which implements the above idea by choosing levels at random for each line, one at a time. As it does this, the program builds a skeleton of the tiling, filling the cubes occupied by the specified configurations, checking that no overlap is produced. For a given line, if the chosen level produces overlap with previously placed blocking configurations, the program tries again, repeatedly choosing a new level at random until one that does not produce overlap is found. If it cannot find one, the program gives up.
In the case $n = 110$, the program is successful, empirically, about 80% of the time. For $n$ a little below this, it starts to fail most of the time. The smallest successful tiling I found was at $n = 102$. I've posted this in a pastebin file here. The tiling is formatted as three nested arrays in python syntax, such that the level for the line in the $x$-direction given by $y = a$, $z = b$ is xlist[a-1][b-1], the level for the line in the $y$-direction given by $x = a$, $z = b$ is ylist[a-1][b-1], and the level for the line in the $z$-direction given by $x = a, y = b$ is zlist[a-1][b-1]. I've also added python code which performs the verification step, of checking that no overlap is produced by placing configurations at the specified levels, in another pastebin file.