I read this story in the 1990s or early 2000s, I believe.
It was about a world with three layers or zones, and in order to travel from one zone to the next, travellers could only do so naked, otherwise a force field in the tunnel would prevent their passage.
The second layer had many voice-activated "magic" devices, such as flying chairs, and put an emphasis on the number 6.
The third layer had demons, and placed an emphasis on the number 5.
The end of the story is that the system was devised to trap demons in the third layer, and the technology and numerology of the second layer was supposed to make it inhospitable and/or its population unsusceptible to the demons.