library of babel
Library of Babel. Jorge Luis Borges

Imagine a library whose books contain every possible combination of letters and numbers. When you really think about it, the implications are staggering. Assuming that you really have every possible combination, that means that you will have every poem ever written and every poem that will ever be written. You will also have every scientific finding—every discovery and moment of “Eureka!”

With this, you could unravel the universe and uncover the greatest works of art. You would also have every history that was lost to time’s decay, and you would have an outline of every possible future for every person alive today (and also every person who may yet be born).

In short, it would contain an accurate account of your death.

Of course, in order to make this library, you would need a nearly infinite supply of paper, ink, and time. Enter Jonathan Basile, the creator of The Library of Babel.

Basile was inspired to create a truly comprehensive library by Jorge Luis Borges’ text  “The Library of Babel” (“La Biblioteca de Babel”). In this piece, Borges describes his version of a universal library, one that literally contains every phrase and every word that could ever be written. In other words, this library would contain every possible combination of letters, thus containing nearly every book that ever has been and every book that ever could be.

And if we are literally talking about every possible arrangement of letters (we are), then the library would also contain pages and pages of utter nonsense.

However, if you were to sort through all the inane ramblings, eventually you would uncover, well, everything. Borges described the Library in a 1939 essay, “The Total Library” (“La Biblioteca Total”), which was a precursor to his aforementioned short story:

Everything will be in its blind volumes. Everything: the minute history of the future, The Egyptians of Aeschylus, the precise number of times the waters of the Ganges have reflected the flight of a falcon, the secret and true name of Rome, the encyclopedia Novalis would have constructed, my dreams and daydreams in the dawn of the 14th of August in 1934, the demonstration of Pierre Fermat’s theory, the unwritten chapters of Edwin Drood, those same chapters translated into the language of the Garamantes, the paradoxes Berkeley cerebrated concerning time and never published, Urizen’s books of iron, the premature epiphanies of Stephen Daedelus which before a cycle of 1000 years will signify nothing, the gnostic gospel of Basilides, the song the sirens sang, the faithful catalogue of the Library, the demonstration of the fallacy of that catalogue. Everything, but for a rational line or just notion there will be millions of nonsensical cacophonies, of verbal farragoes and babblings. Everything, but the generations of men can pass without finding among the vertiginous shelves – the shelves that obliterate the day and in which the chaos dwells – a single tolerable page.

For previous generations, such a library was nothing but fantasy; however, Basile, who studied English literature at Columbia University, saw that computers could allow us to actually make Borges’s vision into a reality. As such, Basile set out to make the Library come to life.

Notably, he removed the numbers in order to make the project somewhat feasible.

After that, he spent six months trying to create his library. Unfortunately, he discovered that it would still require more digital storage than could fit in the entire universe. To make the task even more manageable, Basile utilized books that are 410 pages long and contain 3,200 characters per a page. Even with these limitations, he calculated that the number of “books” would be somewhere around 10 to the power of two million.

So he had to settle for a library that exists as an algorithm. This program runs whenever someone plugs in text at libraryofbabel.info. He also scaled it back so no two books share a page, and the library still has 10 to the power of 4,677 books.

Basile notes, “Since I imagine the question will present itself in some visitors’ minds (a certain amount of distrust of the virtual is inevitable) I’ll head off any doubts: any text you find in any location of the library will be in the same place in perpetuity. We do not simply generate and store books as they are requested – in fact, the storage demands would make that impossible. Every possible permutation of letters is accessible at this very moment in one of the library’s books, only awaiting its discovery.”

He continues by clarifying exactly how the process works:

The site doesn’t store books on disk, and it doesn’t create them as they’re requested then store those pages. But, it does always place the same page of text at the same “location” in the library. It does this by using a pseudo-random number generating algorithm called a linear congruential generator. In order to be able to produce every possible page of 3200 characters, the PRNG requires a seed of about 16000 bits – in base ten, that’s a number with ~5000 digits!

When you request a page, the CGI does the following calculations:

1)book location -> base ten random seed 2) random seed -> output of PRNG 3) output of PRNG -> page of text

The search function inverts each of these calculations:

1) page of text -> base ten output of PRNG 2) output of PRNG -> random seed 3) random seed -> book “location”

To search for a phrase, simply head here, and you will find its location. The program works in such a way that it displays all of the pages on which that text would appear if the library were a real, physical thing. In this respect, although the page is not real (you can’t pick it up and it’s not stored), the page exists as a set of coordinates, so it will be the same each time.

If you want to see another handy take on this, be sure to check out this video from Vsauce.

And as a random aside before you begin your search, as one person in the FQTQ Community pointed out (using a variation of a quote from Neil Gaiman) “A search will give you 10, 000 answers. But the librarian will give you the right one.” So while it is an interesting bit of technology, in reality, it may not be the best source for unraveling the mysteries of life, the universe, and everything.