top of page

The Answer to EVERYTHING!

Updated: Jun 17, 2019


Okay. Maybe the title is a clickbait but it is kinda true. If you have already heard about 'The Library of Babel' then you know the title is not a click bait.


WHAT IS LIBRARY OF BABEL ?


<Inserting directly from wikipedia>


"The Library of Babel" is a short story by Argentine author and librarian Jorge Luis Borges (1899–1986), conceiving of a universe in the form of a vast library containing all possible 410-page books of a certain format and character set.


Now that's a HUGE library. There is a website libraryofbabel.info where you can search and browse through all the possible books. So in theory, the song lyrics from a movie that will be released in 2100, upcoming George R. R. Martin's GOT final book and the answer to life, universe and everything (NO! The answer is not 42!) is available in that library.


Every word spoken in the past and every word that will be spoken in the future exists in that library.


Heck! The blog I'm writing now here is already there in that library. If I could find the right book I could have just copy-pasted my article from there. A library with all the possible books, arranged randomly is useless but it's a cool concept.. Librarians there must have the most difficult job in the entire Universe.



Can such a MASSIVE library exist in real life?




No it cannot. The library holds a total of 26^(1312000) characters. That's nearly 2 followed by 1.8 million zeroes! To put this in perspective, the total number of sub-atomic particles in the observable Universe is 10^(80).

(Note : Here a^(b) means a power b)


So even if you write each and every character in the library on each and every sub-atomic particles in the observable Universe you will still need 10^(1,799,920) such universes to write all the characters in the library.



Holy S#!T.... That's a LOT of Universes!




Creating my own version of Library of Babel


I've always wanted to create a mini-version of Library of Babel in my laptop. For the past few weeks I've been trying to create one. GOD I'm totally exhausted now!


My version of Library of Babel is little bit different. I'll have written my version in more detail here.



At first the concept looked bloody simple to me.


1) Make all the possible combinations and store each of them as separate books (files).

2) Search the book that has the text entered by the user and print the details of the book that has the user text.


I thought it will take 3-4 days to complete the concept. But



Problems in creating such massive library


In my version, different possible combinations of 30 strings [a to z, comma, period, white-space, newline] will be generated for different character lengths and stored appropriately.

(e.g.) For character length 2, there will be 900 books starting from 'aa', 'ab', 'ac' ...... 'az', 'ba', 'bb' ....... 'zz'.


There will be 30^(n) books in each character length,

n - character length.


The no. of books increases exponentially as the character length of the book increases. For a book that has 30 characters, there are nearly 10^(44) possible combinations of 30 strings. In simple, 10^44 books. Each book is 13 bytes in size approximately. So I need 1.3*10^(33) TB of space to store all the books. It's a


Generator Program

Output Screen for Length 6

My version has books with character lengths ranging from 1 to 4 only. The reason for this is to get the search results fast. The user can type characters of any length. The search program will list a number of books which when combined you will get the text entered by the user.


I ran my program to generate book with 6 character length and you can see it took nearly 55 min to generate.




Total size of the books with character length 6

The files are around 25.8 GB! Opening these files and searching for the user text makes my laptop to run out of memory and Windows stops working within seconds.

So I stick with files that have character length <=4.




Searching Program and Result


Output of 'Searching' program

The image shows the output screen for 'searching' program. I have entered the text "Avengers Assemble.." and it shows me a list of books, their locations and their contents. (Just ignore the 3rd book's content)


My code works (Yeaaa!😀) but on a very very small scale (Owwww!😐). But anything is better than nothing. When I think that the answers to every questions are somewhere in my files is pretty incredible (at least to me).


Like I said earlier, I have written in detail about the design of my mini Library of Babel, how the books are arranged, stored etc here



I've included the links to my program in Github below. It's a mess and a bit hard to understand. Take a look at them even if you don't want to because I've put so many hours in figuring out a way to do this. So just click the links below!



In the first program (Library Generator), you can set the maximum character length of the books by changing the range values of for loop in the line 151. So in theory my program will work for any character lengths. All it needs is a powerful computer with huge memory.


After completing the programs,

"I finally rest.... Watch the sunrise on a grateful Universe"


Even though the books are arranged in random order and useless I just want you to remember that


"THERE IS AN ORDER IN CHAOS"

Thanks KAVI PRIYA and my DAD for helping me with this article 😇

Comments


bottom of page