• Published 12th Nov 2013
  • 11,562 Views, 183 Comments

The Library of Discord - Chinchillax

Discord has trapped Twilight in a library that contains every possible book that could exist. Somewhere in the depths lies the one book that can teach her how to escape. But when every idea and story exists, how can she find the one book she needs?

  • ...

Mathematical Notes

The idea from this fanfiction is strongly based on the ideas presented in Steven L. Peck’s novella “A Short Stay in Hell.” If this book intrigued you in any way. Please check out his book. According to Peck in the appendix of his book, the library presented there had books that were 410 pages long, with 40 lines of 80 characters on each page. There were a possible 1,312,000 characters in each book with 95 characters on a possible keyboard. Resulting in a library with 95^1,312,000 number of books. Or a library 7.16^1,297,369 light years wide and deep.

The Library of Discord is based off of the question, “How many books would exist in the Library of Babel if someone were to simply spell check all of the books before adding them to the library?” The eventuality of such a task would be that all combinations of all the words in the provided dictionary would have to exist somewhere in the library. Given a dictionary of 200,003 words (estimates of how large the English language is is actually around 250,000 words. The 3 is there because a prime number was easier to deal with when creating the library). Dividing the number of characters in a 410 page book (1,312,000) by five (5.1 being the average number of letters per word in the English language) produces 262,400 number of words in each book. This results in a library with 200,003^262,400 number of books.

To put this number in perspective, according to Wolfram Alpha the number of books in the Library of Babel in “A Short Stay in Hell” is 2.45*10^1203781 times more than the number of books in the Library of Discord. (Spell checking is a wonderful thing).

Books were calculated as being 3 cm thick each, 40 cm to shelve vertically. Each shelf can fit 2000 books on each 60 meter long shelf. Each side has 8 shelves each containing 2000 books each. Or 32000 books in a cubic area of 4*3*60 (4 meters- height of the hallway, 3 meters width of hallway, 60 length of bookcase) or 720 cubic meters.

The number of books in the Library of Discord is 200003^262400 number of books. That number divided by 32000 would be the number of 720 cubic meter spaces that the library would need to have.

1.33 x10^1390989 number of 720 cubic meter blocks.

At this scale, only the number of digits matter.

10^463663 meter wide and deep library

Divide by the number of meters in a light year (9.46 x10^15 meters)

Resulting in a library 10^463647 light years wide and deep.

The universe is estimated to be 91 billion light years wide. So divide 10^463647 by 91 billion.

So in total size, the vertical, hexagonal shaft of the library of Discord is approximately 10^463636 number of universes tall.

Comments ( 120 )


This story is unique among those I've read; it feels less like a narrative and more like a mathematical thesis posing as one, with poor Twilight as the guinea pig.

That's not a criticism, though. I love this kind of stuff. My jaw dropped the way Twilight's did when she realized the sheer scale of the library...

Have a fave and upvote.:twilightsmile:

Edit: That comment was written before Fluttershy's involvement where the feels begin to ramp up, so I take it back. I do still love the mathematical theory though. xD

I know how to do all of that stuff. But I wanted to get the full number.

But then I realized my computer couldn't generate something that massive.

And Fim Fic couldn't handle it.

XD there is a lot of math, and I was worried it might be too much, but I'm glad you still enjoyed the fic!

Good for you for trying!
I used Wolfram Alpha for all of my math calculations. I'm surprised that website can even calculate numbers that large.


Wow, googling your post I realize that I need to read more of the Discworld novels. I've read about 10 of them but I had no idea about Library-Space. I knew this concept had to have been explored in more places but I didn't know Discworld was one of them.
What's the first novel in the series that talks about L-Space, is it "The Science of Discworld?"

3478575 I think it might be "Guards, Guards" The Librarian used it for limited time travel.

:pinkiecrazy: I like math too.
Good job on the calculations!


It's on purpose.
I'm trying to convey just how much different the entity in the prologue is from what Discord has become due to the effects of the library.


Shoot, I've read that one too, though it's been a few years. I'll have to go back and read it and check out L-Space. Thanks!

3478583 3478325
Still, the exact numbers would be completely meaningless as they are just approximations based on statistical means, the english language and exactly identical sizes of books.
It does not give us how many different books there could possibly be, but rather indicates what the scale of such a number would be.

EDIT: While the books in this library fulfill such specifications, there is a catch. Compare two books, one filled with 262400 times the word "a", one with the word "pneumonoultramicroscopicsilicovolcanoconiosis" as many times. None would appear in the Library of Babel, but both would appear in the Library of Discord. Thus, if Discord's library truly was the Library of Babel with a spell check, it would be much, much smaller. (But still insanely large.)


The idea was to simply spell check the Library of Babel, and that would be the Library of Discord. The problem I ran into was figuring out how many books that would end up being. I made a rough calculation based on the number of books in a language and the number of words in a 410 page book, so my calculations will be off. Is there even a way to calculate a spell checked library of Babel?
I wrote a computer program that would spell check random gibberish and feed me back what words got through the spell checker, but all I got were extremely short words, particularly the letter "i" and "a" over and over again. Only 1 in about 11,000 attempts to create a single page of coherent text for the library actually succeeded, but then my code would only make a random library, the program I'd have to make would have to systematically create every book ever. There simply aren't enough electrons in the universe to even make a quantum computer that could store a library like that, so estimation is all I've got to work with.
What I really want to find out is how many books would exist in a library completely spell and grammar checked. I want to see if there's a way I could use Microsoft Word's grammar API and see if I can make an estimate, but the code is still over my head.


Thanks so much! I'm glad you enjoyed it!

This is one of the truly great stories on the site, as it is both a thought-provoking what-if sci-fan work, as well as a feels-generator.

Incidentally, our good friend Information Theory (hat-tip to xkcd, of course) suggests a method that could be used to estimate how many books there could be in that library that would actually "make sense" in that they could convey narratives.

Because, it is actually possible to (loosely) measure the information content of a language.

Claude Shannon showed groups of people samples of typical written English which were cut off at a random point, and then asked them to guess what letter came next. Based on their rates of correct guesses, and math stuff, he determined that the information content of typical written English was around 1.0 to 1.2 bits per letter.

xkcd used this to determine that the number of "meaningfully different" Tweets possible in English was 2^140, not 27^140 as the Babel/gibberish thing would suggest.

For our purposes, though, we could use this to guestimate an upper limit of somewhere around 2^1312000 possible "sensical" books, which runs to about 2.26 × 10^394951, far lower than the 9.55 × 10^1390991 that Discord's 200003^262400 figure gives us.

You'd still need a few quinseptillion universes' worth of storage space to put them all in, though.


I'm so glad you found the story thought provoking!
Understanding how big this hypothetical library would be has kind of taken over my life to the point I had to write this fanfic to wrap my head around the concepts.:twilightblush:
Thanks for the link to XKCD's post on the subject, I can't believe I haven't come across that before. Thanks also for Shannon's paper and taking the time to calculate the amount of books of a more sensible library.

I've been longing to see a take on this ever since I first read the Library of Babel.. I must devour this. :pinkiehappy:

I'm super impressed that this story has 0 dislikes. It's rare to see that.

...I probably shouldn't have mentioned it. (someone might dislike it on purpose) :twilightsheepish:

Started it today finished it today. Good job, well written. i thoroughly enjoyed it.

Awesome! I hope you enjoy it!

I know! Having zero dislikes is so statistically improbable, but I'm mighty flattered it's zero so far. :twilightblush:

I'm so glad you liked it!


Trying to find the way out could form so many answers in so many different ways as to make the amount of books with the way out potentially infinite. Or at least a stupidly high amount.

I really, really enjoyed this story, especially because I love math and pondering the seemingly limitless chasms of possibility. I love the way you write, and I do believe you should do write more, I was a bit disappointed to see that this is your only work after I read it. :fluttershysad: I did very much enjoy this, and I definitely think you should write more, and push the limits of what you think you can write. The boundaries are limitless. :twilightsmile:

Wow, that was beutiful. Now I have that sad feeling you get after finishing a good book. I must bring the happy to change things up! Because sometimes you gotta laugh or you'll just go...yeah, you just got to laugh sometimes!
I bet that library has at least one book that just says "Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack. Wabbajack." Over and over again! :pinkiecrazy:

You're amazing dude. :raritystarry:
Edit: Oh and look at that! My thumb up made it go to 77 thumb ups. May good things come your way in life.


Aww thanks! :pinkiesad2:
Reading your comment makes me sad I haven't written any other fanfiction.
Your post is so encouraging!
I have ideas, it's just, what could top this? I know that's a silly problem. There are always more stories and more ideas to share. But if I do any more, it'll probably more slice of life and less philosophical. Thanks for encouraging me to "push the limits of what I think I can write." This was a lot of fun to make so thanks for reminding me of that and making me want to write more. :pinkiehappy:
If you really liked the math and stuff, you can check out the book that inspired me to write this: A Short Stay in Hell. It's pretty dark though.

I'm so glad you liked it! Sorry it had to end! If you're looking for something funny, this is the funniest fic I've read on the site.

3993836 TOO LATE!!! I've already read and faved that cool story. Want to see what is (arguably of course) the funniest thing I'VE ever read on this site? It's here.
Also, making the pretty large assumption I can finish it, could I perhaps reference the library in Discord's mind in my own story about him? They actually go into his mind and this seems like too cool a reference not to make at some point while the six are lost in his head.

Now that I've got to read. Thanks for the recommendation!
Oh my google, YES! :pinkiegasp:
Of course you can reference the library in your story. :pinkiehappy:

3994342 Hope you like Hail to the King. It doesn't even have an cover image and yet it manages to blow so many other things I've read out of the water!

I was thinking of having Twi or one of the others notice a boarded up "room" (it's Discord's head so nothing is truly physical) and commenting on it and Luna mentioning something like how "Some libraries are best left alone." or something to that effect.

And speaking of stories, really quick, do you happen to know an editor or maybe even could edit a story chapter or two yourself? Discordant Dreamscape is going nowhere if I can't find someone to help me edit it and your Discord story was fantastic. It even went along a vaguely similar train of thought with the whole "inside of Discord's head is X" angle. So far I had one guy look, but it's not enough and he had to go do other stuff. :unsuresweetie:

If you PM me a link to the google doc I'll read through it and see what I can do.

I downloaded the audiobook to my phone, and listened to it on my commute to and from work today. Unfortunately, my commute ended before the book did. I can't say for sure how long I was idling in the driveway, listening to the last few chapters, but by my estimates you owe me around $3 in gasoline. You can just paypal that to me whenever is convenient for you.

The math was delicious. Discord's origin story was funny and tragic; it fits him perfectly. Fluttershy's description of loneliness hit me hard in the feels. The writing quality was top-tier. The audio production was brilliant, the sound effects gave the story just enough ambiance without being distracting.

I have only one small constructive criticism to offer. Not with the story itself, but with the audio production. There was a small amount of white noise in the recording. Not enough to be noticeable while you were speaking, but enough that I noticed its absence during cuts. There are a few ways to minimize noise in Audacity, but you might be better off just splicing a bit of room tone over your cuts. Hardly worth mentioning, really.

So, you managed to hit one out of the park with your very first story, and are reluctant to start another for fear of diluting your success? Now where have I heard that before... ah yes, the Twilight Sparkle micro series. Understandable, but you really ought to write another anyways. Just think... somewhere out there, your next story already exists. :raritywink: Go now, and seek it out.

I regret that I have but one upvote to give to you. Keep up the good work.

Listened to the audiobook. Man, that was great.


L3gion, I'm so glad you enjoyed it! Sorry about the gas though, would 1000 Dogecoin call it even? :moustache:

And thanks for mentioning the hiss in the background of the recording. I've completely changed how I edit audio now, and I've learned some better recording tricks.

And yes, I do have stories coming... eventually. I started writing three different fanfics, hopefully I'll finish at least one of them. :twilightsheepish:

Well that was a very enjoyable story. I was about to type "read", but in reality I listened to the audio version you posted rather than being restricted to my computer screen. Reading was done very well, and the content of the story was also awesome. I loved the direction you went with discord. Granted, it warps the very imagination to speculate at what such a being would be like. It seems very unlikely anything that has existed for such a long period would have anything resembling normal sanity, Libray of Babel notwithstanding.

It's too bad Discord didn't read any books on the computation of regular languages before he cast his library spell. Then he could've written a language to represent valid sentences and add books only if every sentence included was a valid sentence.

Some very interesting things happen as T -> ∞. If Accord somehow continues to exist indefinately, then eventually he /will/ experience a friendship with Fluttershy again, because random chance will conspire to create that same universe again, in that exact same configuration. Eventually, if he's patient again. What a fun, yet subtly horrible future. Can't really blame discord for not making friends with non-immortals. Really, I'm amazed he even bothers to interact with Celestia. From his perspective, she's not much older than any of the ponies.

Very enjoyable all the way through. Loved it!

I really enjoyed this story. :pinkiehappy:
And since I'm fascinated by mathematics, the concept of such a vast library and infinity in general, it made the fic much more enjoyable to me.
And since I read it, I like Discord a lot more than I used to. :twilightsmile:
Did I mention I like vast numbers and stuff like that beyond imagination? :pinkiecrazy:


Just to show how screwed Twilight was without Discord's assistance, in order to get the amount of books she had to check below a trillion, she would have had to write all but the last TWO WORDS of the book. Given 200,003 words, there are about 40 billion possible combinations for 2 words. 3 words would be approximately 8 quadrillion. Four words? 1.6 sextillion, or 1,600,000 quadrillion. So unless the missing portion of the spell to escape the library was 1 or 2 words long, she'd have spent countless eons in that place.

50 pages? Poor, naive Twilight. Exponentiation is a terrible thing.

"Some very interesting things happen as T -> ∞." That sounds like the title of a really creepy or possibly really funny story. These are really weird ideas to think about, I mean you're right, Accord really could meet Fluttershy again in this exact configuration assuming infinity continues indefinitely. When reaching time at those levels, stuff like that is absolutely possible. And thinking about it too hard turns into philosophical horror. :rainbowderp:

I'm glad you enjoyed it!
I love vast numbers too. :trollestia:

Wow, thanks for calculating that out! I very much agree that "exponentiation is a terrible thing." Every word that Twilight wrote down exponentially brought the amount of books ever smaller but, as you calculated, it would have never been small enough to reasonably go through.

As I started reading this, I immediately up voted it. Now, I'm left wondering whether I should or could down vote it.

Let me clarify; this is kind of a complaint...out of left field. Very, very out.

I dislike the fact immortality is, yet again, treated like some horrible curse.
It's...a tired old trope, and actually kind of offensive if one thinks about it for too long; it's like saying "we're gonna establish a socially acceptable age limit (say, 50 years old) and we're gonna kill anyone older than that. And kill anyone who celebrates their fiftieth birthday.
Because...well...death and aging aren't actually absolutes. (ok, death is, but bear with me). What we used to call "old age" has, time and time again, proven to be sicknesses which can be cured. And seeing as there are actual animals out there who don't die of old age (lobsters, some jellyfish, some turtles, etc) there's nothing that says humans can't achieve this state either.

Discord's immortality (at least in story) is very, very different from what's just been described; and in his case, it...might make sense for it to be considered a curse.

in all his wandering through his own library, he never read a self help book on how to cope with this sort of thing?
In all the time he has had available, he hasn't tried suicide? Or...you know...tried expanding his knowledge base from outside universes so he can figure out what he's made of and how to modify it?
Hells, considering in the actual story he manages to change his mind on several things, hasn't he tried to self modify his mental makeup so that solitude/immortality doesn't bother him?
Actually, why not learn how to partition is mind and memories so that he has an eternal companion? Or BUILDING himself immortal friends, since he has nigh infinite power.

And...Fluttershy is seriously the only being who tried to befriend him in...forever? What? :-/

As it stands though, I'll leave my up vote as it is, since these criticisms are orthogonal (oh god I hate using that word in this context but couldn't find a better one) to the actual story itself.

I just wish it hadn't left a bad taste in my mouth :-(


If you want to give me a downvote, that's okay. You've told me why I'm getting a downvote, and to be honest, receiving a downvote and knowing precisely why I've been given a one is worth more to me than a single upvote. It gives me a chance to learn, improve, understand, and think more deeply. Thank you!

Now, you bring up some very interesting points.

in all his wandering through his own library, he never read a self help book on how to cope with this sort of thing?

Reading this gives me this image of Discord opening up a book titled on the first page: "Beginners Guide to Immortality: How to cope with a lot of time on your hands." I like your idea of a self-help book specifically tailored to Discord.
However, I do want to point out that Discord's favorite book in the library was filled with 360 pages of Twilight's rambling.

She wrote about ... how every book existed in the library. How insane this place was. How Discord could possibly learn all the truth and beauty the universe had to offer in this library, but how every lie was learned at the same time as a single truth. About how much she really did love books, but she understood now how much more powerful friendships and relationships are.

I like to think that Discord was reading this book complaining against him, and finding out about all the friendship lessons that the Mane 6 and Spike will go through. He was reading this and realizing that friendships and relationships really are more powerful than books. It planted the idea that he really needs to get some friends.
But the problem is that while he did read this book, there were always other books that said the opposite, the nonsensical. It messed with his mind and his worldview multiverseview, skewing Accord into becoming the Chaotic being Discord.

And...Fluttershy is seriously the only being who tried to befriend him in...forever? What? :-/

I like to think of it as that Discord every once in a while would go outside of his library and take a look at what the current configuration of a universe is like. He would stop, experiment around on whatever sentient or non-sentient beings inhabit a place, see that his ideas (chaotic experiments) were unappreciated and unwanted (He got turned to stone, or banished somewhere), and go back to his library. He doesn't leave himself much room for actually getting to know the beings of those worlds.

Fluttershy is also the only being that Discord has allowed to befriend him. Discord could have very well taken Twilight up on her offer and talked to her, instead he opened a portal and tried to shove Twilight, Spike and Fluttershy away. He only wanted to allow himself to be befriended if someone were to really make an effort to befriend him. He also had his mind set on seeing his favorite book actually happen, which it did.

Or BUILDING himself immortal friends, since he has nigh infinite power.

This is the happy ending I had in mind. Discord finally understanding that he's been doing immortality completely the wrong way. Immortality is painful, but only if experiencing it without friends and relationships. When all of your friends and family are also immortal, being immortal is the best thing in the multiverse. This is why he chooses to be with Fluttershy, take on his old name, and change his form. He's going to try something new, an experiment to see if being immortal is actually fun as long as he has someone with him.

The story, as it stands, leaves what will happen considerably open ended, but I was hoping to imply that Fluttershy does eventually agree to be immortal like Accord and they live happily ever after.

I don't really know what would be the happiest ending possible, and the right way to tell how it got that way. It's why I haven't written an epilogue or a sequel. I'm not quite sure myself, but I do want Accord and Fluttershy to raise a huge family. And Accord to casually make more and more ponies, especially his friends the Mane 6, Spike, and others, immortal.

Those are just things I’m still thinking about. Thank you for the feedback and giving me more things to think about.:twilightsmile:

Found this reading of your story. Great story, Borges should be better known. Hooray for immortal Fluttershy!


To be honest, I don't know either. :twilightblush:
One of my prereaders was in the middle of his masters degree in math and he helped me a lot with the mathematics. He explained that making the numbers prime would make it easier for the Library to be random and indexable so that Discord would be able to access books faster.

Here was his explanation:

I've been thinking about an interesting layout for the library. If the library shows the books in lexigraphical order, it would be incredibly boring. Each book would almost always be exactly like the last, except for the last word. If they're random, it would be nigh impossible to make sure the library is complete.

In order for it to work, the number of books must be a power of a prime. The best way to do this is to use a prime number of words. Type in RandomPrime[{200000, 250000}] on Wolfram Alpha, with whatever bounds you feel are appropriate.

This results in something called a finite field. This allows for some nice properties. It has addition, subtraction, multiplication, and division in it. Seriously, the math works like what you're used to. I still remember the first time I used the quadratic equation in a finite field. All the math it's based on exists, so it still works, provided you don't mind that you have to find square roots through exhaustion.

There are particular books that are what are known as generators. If you take any book except the additive identity (also known as 0, and most likely the book that just has the word "A" over and over again), and multiply it by a generator over and over, you will eventually get every book except zero.

That only gives you one dimension. Unfortunately, there's no good way to make this work in three dimensions. The best I can come up with is to use a space-filling curve. My personal favorite is the Hilbert curve: https://en.wikipedia.org/wiki/Hilbert_curve

Using this method, one could, in a perfectly reasonable amount of time, be given a book and say where it is in the library, or be given a position in the library and say what book is there.

I didn't understand all of the logic behind that, but it seemed like a good idea to follow his advice.

As far as why mathematically one book would be missing, this is what he told me:

I suggest just mentioning that ... due to the layout of the library one book is missing. Mathematicians can work out how it works.

Thanks for listening to it! :pinkiehappy:

4276501 4276174

It's not so much easier as it is more interesting. The easiest is to arrange the books in alphabetical order, but that would be incredibly boring.

An analogue for what I'm suggesting is looking at powers of two. If you start from one, and keep doubling or halving, you can never reach zero. If you double in a finite field you will eventually run out of numbers and get to where you started. But you can't get to zero, since doubling or halving would just give you zero. For example, the powers of two in Z mod 11 (the integers, but looping back to zero after you get to ten) are 1, 2, 4, 8, 5, 10, 9, 7, 3, 6 and then it loops back to one.

You can also do something like that with a power of a prime. For example, if you have books that contain two words, where each word is from a set of 11, you can include the square root of negative one, and look at the powers of 1+2i. It would get you 1, 1+2i, -3+4i = 8+4i, etc. I'm not sure if that would loop through all of them, but there is something that would.

It's worth noting that an LFSR, a common pseudorandom number generator, is just doing this using two as the prime number.

Come to think of it, that would not make it easy to find the position of a given book. You could have some fun reversing it, and using that method to figure out where to put each book. That way, Discord would be able to find the book he wants easily if he has one in mind, but he would never be able to guess what the next book says. If he did it this way, rather than not having a position for the zero book, he'd not have a book for the zero position. Also, the algorithm would put the last book in the same place as the first one, so he'd probably just move one of those to the zero position.

Another thing you could do is raise the generator to a power represented by a given book. This would still have a position for the zero book. It would always be at the beginning of the library, which is boring, but it would have a position. In this case, it would be easy to figure out where a given book is and what the book in a particular place says, but only if you know which generator Discord is using.

The problem with this method is that each book must represent an integer, and the number of books must be the size of the field minus one. This means that you have to find a solution to p^n-1 = a^b, where p is prime, a is the number of words in the dictionary you use (200,000 to 300,000) and b is the number of words in a book (about 250,000). I have no idea how to tell if there even is a solution to that. I know if n = 1 (which would make a lot of things easier) then b has to be a power of a, which in the number range we're dealing with means a = b. I don't know if that holds for any n. I don't think there is a solution. You could cheat a little by only looking at the first p^n-1 books, but then you essentially have a section of the library missing.


I forgot to mention, I'm the guy that told Chinchilax the math stuff.


Huh, you managed to turn most of my criticism on its head, and actually make me re-evaluate the story.
It's good to know your interpretation of your own story is so...dammit, I'm too tired, it's the middle of the night here and I'm not thinking straight.
TL DR in the end I won't downvote the story and I'll leave the upvote as it is


Thanks for the explanation, DanielLC!
This reminds me a lot of how hashing works in Computer Science. Is this the exact same principle being applied here?
Hashing, for those interested, is how passwords are encrypted and retrieved. A password like "flutt3rc0rd" would get run through an algorithm and spit out a random phrase like "cbfe9cf1a723a1f942a18aa0f832b7df." By using the same algorithm in reverse, the random phrase can be brought back to it's original state. Part of a hashing algorithm is when the entire thing is modulated by a prime number, this lessens the chance of two different large hash words being in the same place. This is part of how passwords are safely stored. And part of how books could be randomized in the library and still be indexable so that Discord could tell precisely where a book was, but not necessarily know the contents of the next book on a bookshelf.
Did I understand all that right?

If he did it this way, rather than not having a position for the zero book, he'd not have a book for the zero position. Also, the algorithm would put the last book in the same place as the first one, so he'd probably just move one of those to the zero position.

So is this the part where mathematically one book would be missing? Or is was that reference just something so beyond in mathematics I probably shouldn't bother trying to figure out.

Well I'm glad I was able to explain the happy ending I had in mind, even if the story itself didn't explain it very well.
Thanks so much for taking the time to comment! :pinkiehappy:


I actually don't know all that much about how hashes work. The big difference is that hashes aren't required to be unique. Quite the opposite: hashes are designed to be a specific size no matter how much data you're hashing. With this, it would loop around after a certain point, but ignoring that it gives you a bijective function.

The way I originally suggested arranging the books so that there's an extra one left is book = generator^position. This means that position is an integer, and book is a member of a field. It's impossible to get zero from this, since you can't get zero by raising a number to a power, so there is no position that has that book in it.

The version I came up with in my last comment is position = generator^book. Here the book is an integer, and the position is a member of a field. In this case, ever book gets used, but position zero never gets filled, and thanks to the Chinese remainder theorem, the p^nth book and first book get filed into the same position. You could try to set it up so that you have p^n-1 books, but I doubt you could get a dictionary and book size to make that work. The other option is to just have p^n books, and either have two books (the one that's just "a" over and over and the one that's just "zythum" or whatever comes last over and over) in the generator position, or just stick one of them at the otherwise unfilled zero position.

The more I think about it, the cooler it seems to cast a spell on the first and last book so that they don't interact with each other, and just shelve them in the same spot.

Also, I was thinking of how you could shape the library. I'm thinking it would be coolest as a torus. That is, make it so if you walk past one side of the library, you loop back around to the other, like a game of asteroids. You could also make it move you to the side a little, so that following one hallway would lead you to all of the books. You could even make it rotate 360 degrees every time, which would mean that one wall of one hallway would be enough to find all of the books. It would also make all the books on the other wall upside down, and it would require that you can walk on the ceiling as easily as the floor.

Regarding the Who Wants to Live Forever? vs. Living Forever is Awesome, I'm normally firmly on the Living Forever is Awesome camp, but Discorded is getting kind of old. It's not like he's 3^^^3 years old and is incapable of novel experiences, but he's old enough that if novelty ever wears off, it would be wearing kind of thin by then. I don't know how big a problem that would be. Maybe he'd be happy redoing all his favorite experiences over and over again, so long as he never has the same one twice in a billion years. But maybe that's not the case.

If Fluttershy is somehow new to him, then he should definitely spend a few billion years with her and see how he likes it.

It's worth noting that, given his age, it's highly unlikely that Fluttershy is all that new an experience. The kind of stubbornness required to have less than a one in a trillion chance of deciding to leave the library on a given eon is insane. Each time, he has a chance of befriending someone, which is going to be more than one in a trillion, because how could he be that unlikeable? Fluttershy is theoretically unique, but there given a trillion people, you'll find one with a given attribute very close to hers. Once you find one who has all of a thousand attributes almost identical to her, they'd be humanly impossible to tell apart. This means that he'd befriend someone virtually identical to Fluttershy at least around 10^400,000 times. Realistically, there'd be a strong correlation in personality attributes, and Fluttershy's personality isn't even going to be consistent within that precision. He'd probably befriend "her" a lot more than that.

Comment posted by devas deleted Apr 24th, 2014


We need to know what hashing can and cannot do:

Let us suppose that one wishes to find datacoruption. We could keep 2 copies of a file and occasionally compare them. If they do not agree, we know that we have a bitflip. ¿Which file is intact? For knowing, we need 3 copies, and have to compare them occasionally and let majority rule. Hashes make catching errors much easier:

One treats the bitstream of the file as a big number. We long-divide it by a large prime number. Let us suppose that we use a 64-bit prime. We end up with a 64-bit remainder. We save the hash 3x in the metadata of the file (we can catch the damage to the hash by comparison and only have to sacrifice only 192 bit of storage), and occasionally hash the file every now and then. We do the same thing to the backup —— ⸘do not you just hate it when your hard drive fails and the backup is corrupt too? If the primary file or the backup become corrupt, just copy over the intact version from the other filesystem. It is possible that a bitflip will generate a remainder with the same value, but the odds are 2^63 < 2^64 (it is exactly 1 over the prime number we use). One only needs the file on the live filesystem and a backup too. One should periodically rehash both the life files and the backup files for catching and correcting silent corruption from bitflipping.

Everypony knows that one should not store passwords in plain text in the PassWordDataBase. Someponies, like those ponies in Adobe, hashed the passwords. Taking advantage of missettings, crackers stole the PassWordDataBase of Abode. The crackers then use a RainBowFile to recover all spellchecked passwords:

The crackers hash every word in every dictionary they can get and write the results out into textfile consisting of thus:

HashText as HexaDecimal:
Plain Text

Then they use GREP or some other SearchProgram to find the spellchecked passwords.


Since the HashText as HexaDecimal is not spellchecked, the multivolume RainBowFile does not exist in the Library of Discord.

Here is video about how to use hashes for catching file corruption in filetransfer:

Here is a video about how to _"*NOT*"_ store passwords:


Oh... that makes sense! The hashing algorithm can spot corruptions in data because it spits out a single line of text which changes based on the source file. If any part of the source file is different than the hash is different, making it ideal for checking errors or corruption of data. Right?

Hashes, by themselves, are bad for password use. If I'm understanding computerphile correctly, the current best way to store passwords (aside from login via Google) is using "SALT" (a randomly generated string of characters for each user), and combine that with their password and then hash that.
Thanks for the warning, links, and the explanation!


Yeah... I'm thinking the hash idea I had wasn't how this works. It was a parallel I thought worked but doesn't. :twilightblush:

The other option is to just have p^n books, and either have two books (the one that's just "a" over and over and the one that's just "zythum" or whatever comes last over and over) in the generator position, or just stick one of them at the otherwise unfilled zero position.
The more I think about it, the cooler it seems to cast a spell on the first and last book so that they don't interact with each other, and just shelve them in the same spot.

Hmm... those are good ideas. And a very interesting way in which the spell could have been cast. :moustache:

I disagree with you on the torus bit. Having the library reverse back in on itself kind of defeats the purpose of what I was trying to get across. Part of the shock value of the library was that it did have an end. That despite there being a number that can be attached to the size of the library, for all intents and purposes it might as well be infinity. That's the conundrum of the library, it is, in fact, finite, despite feeling infinite.

As far as your other comments... it's putting some holes in my happy ending. I'll have to think about this, and possible solutions. Thanks for being the fuel for more ideas.


Oh... that makes sense! The hashing algorithm can spot corruptions in data because it spits out a single line of text which changes based on the source file. If any part of the source file is different than the hash is different, making it ideal for checking errors or corruption of data. Right?


Find a big prime number. Treat the bitstream of the file as a number. Long-divide the bitstrame. The number of possible hashes is equal to the prime number. If the prime number is large, the likelihood of a bitflip generating the same hash is small.

Download a file from the internet and check it against its hash. If the differ, redownload.

Have hashes of all of your files on your live filestystem on your internal hard drive and on your backupfilesystem on your external backupdrive. Periodically, rehash both sets of files for detecting silent corruption from bitflips. If a file has a bitflip, replace it with a copy of the file from the other filesystem. The backupsoftware should do this automatically. It should also automatically clone files nolonger present on the lifefilesystem so that the backup contains 2 copies of files no longer resident on the live filesystem so that it can replaced damaged files with clean copies.

Hashes, by themselves, are bad for password use. If I'm understanding computerphile correctly, the current best way to store passwords (aside from login via Google) is using "SALT" (a randomly generated string of characters for each user), and combine that with their password and then hash that.


For each user, create a long pseudorandom string of bits. Let us say 1 kilobyte of pseudorandom bits (8192 bits). That is the salt. Every user gets a unique pseudorandom salt. One treats the bitstream of the password as a binary-number. One one appends it to the salt. One then takes the hash. One saves the hash and the salt BUT NOT THE PASSWORD in the passworddatabase. If crackers take advantage of some exploit for stealing the database, they still know nothing. Their only hope of cracking passwords is a good old-fashioned dictionary-attack , where, they hope, that the password is a spellchecked word.

Thanks for the warning, links, and the explanation!

You are welcome.

Reads notes; :twilightsmile:
Lies down;:pinkiecrazy:

It kind of messes with my mind to think about large numbers like that too. :rainbowderp:
I'm glad you liked it.

That's Discord according to Celestia.:trollestia:
She would think he's evil. But yeah... I agree that canon Discord is Chaotic Neutral.

Thanks for the guide on backing up and storing passwords, Walabio. I feel like I have a little better grasp of what's going on behind the scenes now. :moustache:

Thanks for pointing that out. :moustache:


We can argue about whether Disvord is good, neutral, or evil forever, but I have a better idea:

Imagine that an AntiFlutterShy pretends to be a friend. Even if this false friend cannot convince Discord to physically harm ponies, imagine the harm, the AntiFlutterShy could get Discord to do. It is too bad that the show will never have an AntiFlutterShy as a false friend of Discord.


Login or register to comment