I know where to find your deepest, darkest secrets...
...as long as they're 3200 characters or less.
A few weeks ago, I stumbled upon the online Library of Babel, an internet gem that contains every possible 3200 character combination of lowercase letters, spaces, commas, and periods stored in an unfathomable number of books. Impossible, right? At first, I assumed it there was some trick behind the site ― storing 104677 books without generating them in real time seemed impossible ― but after reading the theory behind it and testing it myself, I'm convinced.
The inspiration behind the virtual Library of Babel comes from a fantastical 1940s short story by famed Argentinian author Jorge Luis Borges depicting a library with endless knowledge stored in a chain of hexagonal rooms stretching to infinity. Each room has four walls covered with towering bookshelves and two walls with wide archways allowing readers to pass through to other rooms. Unlike the online Library of Babel, however, in the story the library's rooms are truly endless.
A possible layout of the Library of Babel as depicted in Borges' writing (see left). Given his definition of room connection, the Library of Babel has infinitely many configurations that satisfy room configuration conditions.
To avoid confusion, from this point forward the Library of Babel refers to the truly infinite library proposed by Borges.
The creator of the virtual library, Jonathan Basile, visualized possible layouts of the truly infinite library using conditions Borges set in his text (along with a fascinating explanation you can read here), concluding that the library can have infinitely many configurations and can even manifest in the form of a closed circuit of rooms with no opening to the outside.
The last conclusion intrigued me. On the page where Basile describes his observations about the library, he notes that there are several references to closed circuits in the original library text, but the text doesn't specify their size. After toying around with the concept for a few hours, I ran into a challenging problem: without repeating rooms, what's the largest possible closed loop?
If you're a math whiz and want to give this a shot on your own, here's the problem in more formal terms:
Consider a set of rooms in a 2D plane where the set consists of a grid structure of regular hexagons. Each room must have exactly two sides without walls (known as “open sides”) and four sides with walls (known as “closed sides”); no two rooms may have the same arrangement of open sides. All open sides must border other open sides and cannot border closed sides or empty space.
Determine the maximum number of rooms n, such that all the above conditions are satisfied.
Note that the space between hexagons in the figure is solely to distinguish individual hexagons and does not qualify as "empty space".
For anyone who isn't a math major, here's what the question is asking:
Consider a set of rooms in a 2D plane where the set consists of a grid structure of regular hexagons.
Imagine a grid of hexagons, like in the drawing above. We can swap some of the hexagons in the image for empty space if we want to.
Each room must have exactly two sides without walls (known as “open sides”) and four sides with walls (known as “closed sides”); no two rooms may have the same arrangement of open sides.
Since a hexagon has six sides, each hexagon has four sides of solid wall (in black below) and two sides without walls (in blue), like this:
The "no two rooms may have the same arrangement of open sides" means that no two hexagons can have the same two open sides:
All open sides must border other open sides and cannot border closed sides or empty space.
This means open sides (marked in blue) can only connect with other open sides.
Determine the maximum number of rooms n, such that all the above conditions are satisfied.
What's the highest number of rooms possible with the above guidelines?
Stumped? I was, too. It took me a while to find a solution, and only after discussing the problem with friends over dinner and receiving some advice from my roommate did I crack the nut.
Next week, I'll reveal the solution and the method behind it. Until then, try your hand at finding the solution. Happy solving!