Dice in the Witch House

“Who could associate mathematics with horror?”

John Buchan answered that question in “Space” (1911), long before H.P. Lovecraft wrote masterpieces like “The Call of Cthulhu” (1926) and “Dreams in the Witchhouse” (1933). But Lovecraft’s use of mathematics is central to his genius. So is his recognition of both the importance and the strangeness of mathematics. Weird fiction and maths go together very well.

But weird fiction is about the intrusion or eruption of the Other into the everyday. Maths can teach you that the everyday is already Other. In short, reality is weird — the World is a Witch House. Let’s start with a situation that isn’t obviously weird. Suppose you had three six-sided dice, A, B and C, each with different set of numbers, like this:

Die A = (1, 2, 3, 6, 6, 6)
Die B = (1, 2, 3, 4, 6, 6)
Die C = (1, 2, 3, 4, 5, 6)

If the dice are fair, i.e. each face has an equal chance of appearing, then it’s clear that, on average, die A will beat both die B and die C, while die B will beat die C. The reasoning is simple: if die A beats die B and die B beats die C, then surely die A will beat die C. It’s a transitive relationship: If Jack is taller than Jim and Jim is taller than John, then Jack is taller than John.

Now try another set of dice with different arrangements of digits:

Die A = (1, 2, 2, 5, 6, 6)
Die B = (1, 1, 4, 5, 5, 5)
Die C = (3, 3, 3, 3, 4, 6)

If you roll the dice, on average die A beats die B and die B beats die C. Clearly, then, die A will also beat die C. Or will it? In fact, it doesn’t: the dice are what is called non-transitive. Die A beats die B and die B beats die C, but die C beats die A.

But how does that work? To see a simpler example of non-transitivity, try a simpler set of random-number generators. Suppose you have a triangle with a short rod passing through its centre at right angles to the plane of the triangle. Now imagine numbering the edges of the triangles (1, 2, 3) and throwing it repeatedly so that it spins in the air before landing on a flat surface. It should be obvious that it will come to rest with one edge facing downward and that each edge has a 1/3 chance of landing like that.

In other words, you could use such a spiked triangle as a random-number generator — you could call it a “trie”, plural “trice”. Examine the set of three trice below. You’ll find that they have the same paradoxical property as the second set of six-sided dice above. Trie A beats trie B, trie B beats trie C, but trie C beats trie A:

Trie A = (1, 5, 8)
Trie B = (3, 4, 7)
Trie C = (2, 3, 9)

When you throw two of the trice, there are nine possible outcomes, because each of three edges on one trie can be matched with three possible edges on the other. The results look like this:

Trie A beats Trie B 5/9ths of the time.
Trie B beats Trie C 5/9ths of the time.
Trie C beats Trie A 5/9ths of the time.

To see how this works, here are the results throw-by-throw:

Trie A = (1, 5, 8)
Trie B = (3, 4, 7)

When Trie A rolls 1…

…and Trie B rolls 3, Trie B wins (Trie A has won 0 out of 1)
…and Trie B rolls 4, Trie B wins (0 out of 2)
…and Trie B rolls 7, Trie B wins (0 out of 3)

When Trie A rolls 5…

…and Trie B rolls 3, Trie A wins (1/4)
…and Trie B rolls 4, Trie A wins (2/5)
…and Trie B rolls 7, Trie B wins (2/6)

When Trie A rolls 8…

…and Trie B rolls 3, Trie A wins (3/7)
…and Trie B rolls 4, Trie A wins (4/8)
…and Trie B rolls 7, Trie A wins (5/9)

Trie B = (3, 4, 7)
Trie C = (2, 3, 9)

When Trie B rolls 3…

…and Trie C rolls 2, Trie B wins (Trie B has won 1 out of 1)
…and Trie C rolls 3, it’s a draw (1 out of 2)
…and Trie C rolls 9, Trie C wins (1 out of 3)

When Trie B rolls 4…

…and Trie C rolls 2, Trie B wins (2/4)
…and Trie C rolls 3, Trie B wins (3/5)
…and Trie C rolls 9, Trie C wins (3/6)

When Trie B rolls 7…

…and Trie C rolls 2, Trie B wins (4/7)
…and Trie C rolls 3, Trie B wins (5/8)
…and Trie C rolls 9, Trie C wins (5/9)

Trie C = (2, 3, 9)
Trie A = (1, 5, 8)

When Trie C rolls 2…

…and Trie A rolls 1, Trie C wins (Trie C has won 1 out of 1)
…and Trie A rolls 5, Trie A wins (1 out of 2)
…and Trie A rolls 8, Trie A wins (1 out of 3)

When Trie C rolls 3…

…and Trie A rolls 1, Trie C wins (2/4)
…and Trie A rolls 5, Trie A wins (2/5)
…and Trie A rolls 8, Trie A wins (2/6)

When Trie C rolls 9…

…and Trie A rolls 1, Trie C wins (3/7)
…and Trie A rolls 5, Trie C wins (4/8)
…and Trie A rolls 8, Trie C wins (5/9)

The same reasoning can be applied to the six-sided non-transitive dice, but there are 36 possible outcomes when two of the dice are thrown against each other, so I won’t list them.

Die A = (1, 2, 2, 5, 6, 6)
Die B = (1, 1, 4, 5, 5, 5)
Die C = (3, 3, 3, 3, 4, 6)

Elsewhere other-posted:

At the Mountains of Mathness
Simpson’s Paradox — a simple situation with a very weird outcome

He Say, He Sigh, He Sow #27

“When you run and jump on rocks, your entire brain and body are at work; you stretch your back better than with yoga; every muscle in your body is involved; no two movements will be identical (unlike running in gyms); you become yourself.” — Nassim Taleb, Opacity: A Philosophical Notebook.

The Brain in Pain

You can stop reading now, if you want. Or can you? Are your decisions really your own, or are you and all other human beings merely spectators in the mind-arena, observing but neither influencing nor initiating what goes on there? Are all your apparent choices in your brain, but out of your hands, made by mechanisms beyond, or below, your conscious control?

In short, do you have free will? This is a big topic – one of the biggest. For me, the three most interesting things in the world are the Problem of Consciousness, the Problem of Existence and the Question of Free Will. I call consciousness and existence problems because I think they’re real. They’re actually there to be investigated and explained. I call free will a question because I don’t think it’s real. I don’t believe that human beings can choose freely or that any possible being, natural or supernatural, can do so. And I don’t believe we truly want free will: it’s an excuse for other things and something we gladly reject in certain circumstances.

Continue reading The Brain in Pain

The Whisper from the Sea

─But what is that whisper?

─Ah. Then ye hear it?

─Aye. ’Tis thin and eerie, mingling with the waves, and seemeth to come from great distance. I know not the language thereof, but I hear great rage therein.

─As well ye might. We stand near the spot at which the wizard Zigan-Uvalen bested a demon sent against him by an enemy. ’Tis the demon’s whisper ye hear.

─Tell me the tale.

─It is after this wise…

Zigan-Uvalen woke to a stench of brimstone, a crackle of flame, and found himself staring up at a fearsome ebon face, lapped in blood-red fire, horned with curling jet, fanged in razor-sharp obsidian.

“Wake, Wizard!” the apparition boomed. “And make thy peace with thy gods, for I am come to devour thee!”

Zigan-Uvalen sat up and pinched himself thrice.

“Without introduction?” he asked, having verified that he was truly awake.


“Well, ’tis customary, in the better magickal circles.”

“Aye? Then know this: I am the Demon Ormaguz, summoned from the hottest corner of the deepest pit of Hell by your most puissant and malicious enemy, the wizard Muran-Egah. I have been dispatched by him over many leagues of plain and ocean to wreak his long-meditated, slow-readied, at-last-matured vengeance on thee.”

“Very well. And what are your qualifications?”


“Aye. Are ye worthy of him who sent you, O Demon Ormaguz?”

“Aye, that I am! And will now dev–”

“Nay, nay!” The wizard raised a supplicatory hand. “Take not offence, O Ormaguz. I ask merely out of form. ’Tis customary, in the better magickal circles.”



“Then know this… Well, of formal qualifications, diplomas, and the like, I have none, ’tis true. But I am a demon, thou puny mortal. I have supernatural powers of body and mind, far beyond thy ken.”

“I doubt them not. At least, I doubt not your powers of body, in that ye have travelled so very far and very fast this very night. Or so ye say. But powers of mind? Of what do they consist?”

“Of aught thou carest to name, O Wizard.”

“Then ye have, for instance, much mathematical skill?”

“Far beyond thy ken.”

“How far?”

“Infinitely far, wizard!”

“Infinitely? Then could ye, for instance, choose a number at hazard from the whole and endless series of the integers?”

“Aye, that I could!”

“Entirely at hazard, as though ye rolled a die of infinite sides?”

“Aye! In less than the blink of an eye!”

“Well, so ye say.”

“So I say? Aye, so I say, and say sooth!”

“Take not offence, O Demon, but appearances are against you.”

“Against me?”

“Ye are a demon, after all, unbound by man’s pusillanimous morality.”

“I speak sooth, I tell thee! I could, in an instant, choose a number, entirely at hazard, from the whole and endless series of the integers.”

“And speak it to me?”

“Ha! So that is thy game, wizard! Thou seekest to occupy me with some prodigious number whilst thou makest thy escape.”

“Nay, nay, ye misjudge me, O Demon. Let me suggest this. If ye can, as ye say, choose such a number, then do so and recite its digits to me after the following wise: in the first second, name a single digit – nay, nay, O Demon, hear me out, I pray! Aye, in the first second, name a single digit thereof; in the second second, name four digits, which is to say, two raised to the second power; in the third second, name a number of digits I, as a mere mortal, cannot describe to you, for ’tis equal to three raised to the third power of three.”

“That would be 7,625,597,484,987 digits named in the third second, O Wizard.”

“Ah, most impressive! And your tongue would not falter to enunciate them?”

“Nay, not at all! Did I not tell thee my powers are supernatural?”

“That ye did, O Demon. And in the fourth second, of course, ye would name a number of digits equal to four raised to four to the fourth power of four. And so proceed till the number is exhausted. Does this seem well to you?”

“Aye, very well. Thou wilt have the satisfaction of knowing that ’tis an honest demon who devoureth thee.”

“That I will. Then, O Ormaguz, prove your honesty. Choose your number and recite it to me, after the wise I described to you. Then devour me at your leisure.”

─Then the Demon chose a number at hazard from the whole and endless series of the integers and began to recite it after the wise Zigan-Uvalen had described. That was eighteen centuries ago. The demon reciteth the number yet. That is the whisper ye hear from the sea, which rose long ago above the tomb of Zigan-Uvalen.

The World as Worm

In “Hymn to Herm”, I wrote about a religion based on √2, or the square root of two, the number that, multiplied by itself, equals 2. In the religion, neophytes learn the mystery and majesty of this momentous number when they try to calculate its exact value. The calculation involves adding and subtracting fractions based on powers of two. The first step is this: 1 x 1 = 1. So that’s too small. Add 1/2^1 = ½ and re-multiply: 1½ x 1½ = 2¼. Too big. So subtract 1/2^2 = ¼, and re-multiply. 1¼ x 1¼ = 1+9/16. Too small. Add 1/8 and re-multiply. 1+3/8 x 1+3/8 = 1+57/64. Too small again. Add 1/16 and re-multiply. And so on.

In effect, what the neophytes are doing is calculate the digits of √2 in binary, or base two. When the multiplication is too small, put a 1; when it’s too big, put a 0. Like this:

1 x 1 = 1 < 2, so √2 ≈ 1·…
1½ x 1½ = 2¼ > 2, so √2 ≈ 1·0…
1¼ x 1¼ = 1+9/16 < 2, so √2 ≈ 1·01…
(1+3/8) x (1+3/8) = 1+57/64 < 2, so √2 ≈ 1·011…
(1+7/16) x (1+7/16) = 2+17/256 > 2, so √2 ≈ 1·0110…
(1+13/32) x (1+13/32) = 1+1001/1024 < 2, so √2 ≈ 1.01101…
(1+27/64) x (1+27/64) = 2+89/4096 > 2, so √2 ≈ 1.011010…
(1+53/128) x (1+53/128) = 1+16377/16384 < 2, so √2 ≈ 1·0110101…
(1+107/256) x (1+107/256) = 2+697/65536 > 2, so √2 ≈ 1·01101010…
(1+213/512) x (1+213/512) = 2+1337/262144 > 2, so √2 ≈ 1·011010100…
(1+425/1024) x (1+425/1024) = 2+2449/1048576 > 2, so √2 ≈ 1·0110101000…
(1+849/2048) x (1+849/2048) = 2+4001/4194304 > 2, so √2 ≈ 1·01101010000…
(1+1697/4096) x (1+1697/4096) = 2+4417/16777216 > 2, so √2 ≈ 1·011010100000…
(1+3393/8192) x (1+3393/8192) = 1+67103361/67108864 < 2, so √2 ≈ 1·0110101000001…

Mathematically naïve neophytes, seeing the process miss 2 by smaller and smaller amounts on either side, might imagine that eventually the exact root will appear and the calculations end. But they would be wrong. They could work a year or a million years: they would never calculate the exact square root of two. There is no ratio of whole numbers, a/b, such that a^2/b^2 = 2. In other words, √2 is an irrational number, or number that can’t be represented as a ratio of integers (please see appendix for the proof).

This discovery, made by Greek mathematicians more than two millennia ago, is both mind-boggling and world-shattering. In fact, it’s mind-boggling in part because it’s world-shattering. √2 shatters the world because the world is too small to contain it: in the words of the Cult of Infinite Hermaphrodites, “Were the sky all parchment, the seas all ink, and gulls all plucked for quills”, the square root of two could not be recorded in full. This is far more certain than tomorrow’s sunrise, because predicting tomorrow’s sunrise depends on fallible scientific reasoning from incomplete knowledge. Proving the irrationality of √2 depends on infallible mathematical reasoning.

At least, it’s as close to infallible as human beings can get. But that’s another part of what is mind-boggling about √2. A finite, feeble human being, with a speck of soon-decaying brain, can prove the existence of things larger than the universe. A few binary digits of √2 are shown above. Here are a few more:


The distribution of 1’s and 0’s seems effectively random, as though the God of Mathematics were endlessly tossing a coin, putting 1 for heads, 0 for tails. Yet √2 is the opposite of a random number. Change a single digit anywhere and it ceases to be √2. Every 1 and every 0 is rigidly determined by “unalterable law”. So are the position and magnitude of the digits of √2 in every other base. Here, for example, is √2 in base 4:


Another word for base-4 is DNA: genes are in fact written in a base-4 code based on the chemicals guanine, adenine, thymine and cytosine, or G, A, T, C for short. If the digits of √2 are truly random, in the statistical sense, then all genomes, actual and potential, occur somewhere along its length: yours, mine, the Emperor Heliogabalus’s, Bilbo Baggins’, the sabre-toothed tiger’s, the dodo’s, and so on. But almost all the “DNA” of √2 in base-4 will be meaningless: although √2 is the opposite of random, it is effectively a typing chimpanzee. Or a typing worm – a type-worm. √2 is like an endless worm that types out its own segments on a typewriter with two keys (for binary numbers) or four keys (for quaternary numbers) or ten keys (for decimal numbers) and so on.

But √2 doesn’t just encode the genomes of individual people, animals and plants: it encodes everything they do throughout their lives. In fact, it encodes the entire universe. And perhaps the universe is √2 or some number like it. Perhaps, in some sense, everything exists within the digits of an irrational number, or a sufficiently large rational number. If so, then √2 has become aware of itself through human beings: the World as Worm has bitten its own tail.

Appendix: Proof of the irrationality of √2

1. Suppose that there is some ratio, a/b, such that

2. a and b have no factors in common and

3. a^2/b^2 = 2.

4. It follows that a^2 = 2b^2.

5. Therefore a is even and there is some number, c, such that 2c = a.

6. Substituting c in #4, we derive (2c)^2 = 4c^2 = 2b^2.

7. Therefore 2c^2 = b^2 and b is also even.

8. But #7 contradicts #2 and the supposition that a and b have no factors in common.

9. Therefore, by reductio ad absurdum, there is no ratio, a/b, such that a^2/b^2 = 2. Q.E.D.

V for Vertex

To create a simple fractal, take an equilateral triangle and divide it into four more equilateral triangles. Remove the middle triangle. Repeat the process with each new triangle and go on repeating it. You’ll end up with a shape like this, which is known as the Sierpiński triangle, after the Polish mathematician Wacław Sierpiński (1882-1969):

Sierpinski triangle

But you can also create the Sierpiński triangle one pixel at a time. Choose any point inside an equilateral triangle. Pick a corner of the triangle at random and move half-way towards it. Mark this spot. Then pick a corner at random again and move half-way towards the corner. And repeat. The result looks like this:


A simple program to create the fractal looks like this:

until false

function initial()
  v = 3 [v for vertex]
  r = 500
  lm = 0.5

function fractal()
  th = 2 * pi / v
[the following loop creates the corners of the triangle]
  for l = 1 to v
    x[l]=xcenter + sin(l*th) * r
    y[l]=ycenter + cos(l*th) * r
  next l
  fx = xcenter
  fy = ycenter
    rv = random(v)
    fx = fx + (x[rv]-fx) * lm
    fy = fy + (y[rv]-fy) * lm
  until keypressed

function altervariables()
[change v, lm, r etc]

In this case, more is less. When v = 4 and the shape is a square, there is no fractal and plot(fx,fy) covers the entire square.


When v = 5 and the shape is a pentagon, this fractal appears:


But v = 4 produces a fractal if a simple change is made in the program. This time, a corner cannot be chosen twice in a row:


function initial()
  v = 4
  r = 500
  lm = 0.5
  ci = 1 [i.e, number of iterations since corner previously chosen]

function fractal()
  th = 2 * pi / v
  for l = 1 to v
    x[l]=xcenter + sin(l*th) * r
    y[l]=ycenter + cos(l*th) * r
  next l
  fx = xcenter
  fy = ycenter
      rv = random(v)
    until chosen[rv]=0
    for l = 1 to v
      if chosen[l]>0 then chosen[l] = chosen[l]-1
    next l
    chosen[rv] = ci
    fx = fx + (x[rv]-fx) * lm
    fy = fy + (y[rv]-fy) * lm
  until keypressed

One can also disallow a corner if the corner next to it has been chosen previously, adjust the size of the movement towards the chosen corner, add a central point to the polygon, and so on. Here are more fractals created with such variations: