Some definitions from the story. Each line has 80 characters, there are 40 lines on each page and 410 pages on each book. This allow us to calculate the number of characters on each book.

```
= 410
pages_per_book = 80*40*pages_per_book
char_per_book char_per_book
```

`1312000`

A little over 1.3 million characters on each book. Each character can
be any of 25 symbols. The total number of books is \(25^{1312000}\) which is not easy to
calculate without the proper tools. We have good tools, such as the
`BigNum`

library.

```
from BigNum import BigNum
= BigNum(25) ** char_per_book
books books
```

`1.95604 e 1834097`

This is a really big number. Is like 2 followed by 1.8 million zeros.

A quick “back-of-the-envelop” calculation can confirm this result. We have \[25^n = 5^{2n} ≈ 4^{2n}=2^{4n}\] Thus we are speaking about s little more than 5.2 million bits. Using the rule of thumb \(2^{10}≈10^3\) we get \(10^{1.6\text{ million}}\) books.

The difference between \(5^{2n}\) and \(4^{2n}\) is important, so we will try better. We have

\[25^n = 5^{2n} = 4^{2n\log_4(5)}\]

We have that \(\log_4(5)≈1.16\) so to change from base 5 to base 4 we need to increase the exponent by 16%. So 1.3 millions become 1.5 millions, and so we have near \(4^{3\text{ million}}=2^{6\text{ million}}\) books.

In fact it may be easier just t, \(\log_2(5)\) is a little more than 2, in
fact near 2.32, thus \[25^n =
2^{2n\log_2(5)}≈ 2^{4.64 n}\] When \(n\) is 1.3 million, then \(4.64 n\) is about 6 million. We need 6
megabits just to count the number of books in The Library. Now, \(2^n ≈10^{3n/10},\) therefore there are near
10^{1800000} books.

We need to work with orders-of-magnitude of orders-of-magnitude.

Using more data from the story, we can calculate how many books fit on each room, and therefore how many rooms are in the Library.

```
= 32
books_per_shelves = 5
shelves_per_wall= 4
walls_per_room = books_per_shelves * shelves_per_wall * walls_per_room
books_per_room
books_per_room= books / books_per_room
rooms rooms
```

`3.05631 e 1834094`

Again a very big number. Let’s try to put it in context. First, let’s calculate the area of each room. The area of a hexagon of side \(s\) is \[\frac{3\sqrt{3}·s²}{2}\] Thus, we need to know the width of each wall. We know that there are 32 books on each shelf, so we need to estimate the width of each book.

We need to make some assumptions.

- Paper thickness is around 0.0001m, that is, 10 pages per millimeter. This is based on the fact that a pack of 500 page takes more or less 5cm.
- Each sheet has 2 pages
- The covers are 1 mm each

```
= 1e-4
paper_width = paper_width * (pages_per_book/2) + 2e-3
book_width book_width
```

`0.0225`

Therefore, the wall width is

```
= book_width * books_per_shelves
wall_width wall_width
```

`0.72`

Now we calculate the area of one room

```
from math import sqrt, pi
= 3*sqrt(3)/2 * wall_width*wall_width
room_area round(room_area, 4)
```

`1.3468`

and then the area of the whole library

`* rooms room_area `

`4.11637 e 1834094`

Let’s compare this area with the surface of Earth

```
= BigNum(6371e3)
earth_radius = pi*earth_radius*earth_radius
earth_area earth_area
```

`1.27516 e 14`

```
= 1.6
room_height = room_height / shelves_per_wall
book_height book_height
```

`0.32`

```
= 0.75
aspect_ratio = aspect_ratio*book_height*book_height
page_area page_area
```

`0.0768`

```
= 50e-3
paper_weight = page_area*paper_weight
page_weight = pages_per_book*page_weight
book_weight round(book_weight, 4)
```

`1.5744`

```
= books_per_room * book_weight
room_weight round(room_weight, 6)
```

`1007.616`