I have run across a small number of stories that posit a metaphysical equivalence between traditional magical rituals, and modern mathematical rituals (i.e. computer programming or proving certain theorems):

What is the earliest such story?

I am not looking for systems of magic that "work like" computer programming (Wiz Biz, Dragon Knight, Babylon 5 Techo-Mages, etc.), nor computers that work via magic.

  • Pratchett's Hex is another example, but seems to be from '94. Well, Hex may blur the lines between magic working like computers and computers working by magic, but that's Pratchett for you. Commented May 7, 2012 at 13:06
  • 1
    It's been a long time since I read Soul Music and the other books with Hex, but I think it's not what I'm looking for. As far as I recall, it was just a mechanical computer AI that could cast spells - not all that strange in a world where much biological intelligence can also cast spells.
    – user1030
    Commented May 7, 2012 at 13:14
  • I'm pretty sure this is as old as computers themselves, it's so embedded in the terminology. A synonym for calling a function is to invoke it (you'll often hear something like "man I never use that function, the invocation is too complicated"), and we call background processes daemons. See also: The Jargon File
    – Tacroy
    Commented May 7, 2012 at 16:05
  • @Tacroy: Computers and programming both predate the modern ideas of structured programming (including invocable functions) by decades; likewise you don't find daemon until the mid-60s.
    – user1030
    Commented May 7, 2012 at 16:08
  • I'm totally okay with calling the mid-60's the beginning of computers, I'm not much of a hardware guy :)
    – Tacroy
    Commented May 7, 2012 at 17:44

4 Answers 4


L. Sprague de Camp and Fletcher Pratt wrote a series of fantasy novels based on the premise that mental solutions of certain mathematical formulae could be used to transport them to alternate universes... Not computer algorithms exactly, but the stories go back to the early 40's. [Specifically, "The Roaring Trumpet" in Unknown Fantasy Fiction, May 1940, and "The Mathematics of Magic" in Unknown Fantasy Fiction, August 1940.]

  • Ah, and this reminds me that van Vogt's The World of Ā probably also qualifies, terrible as it may be.
    – user1030
    Commented May 26, 2012 at 21:01

I think the earliest story would be "The Nine Billion Names of God" by Arthur C. Clarke, published in 1953, in which a group of Tibetan monks

use a computer to enumerate all the names of God and end the universe.

  • 2
    Like Hex, this is just a computer casting a spell by virtue of being able to "do things quickly", not an actual equivalence between mathematics and magic.
    – user1030
    Commented May 7, 2012 at 16:18
  • @Joe At this point I'm not clear on the distinction you are trying to draw. In Stross's work for instance proving P == NP doesn't do anything in and of itself, it just gives you a recipe. Rather like statics giving you the understanding to build a good bridge. Commented May 7, 2012 at 17:29
  • 3
    @dmckee: You're wrong about Stross's work. I don't have page numbers because I'm pasting from my ebook copy, but: "Just solving certain theorems makes waves in the Platonic over-space... you can actually amplify these waves, until they rip honking great holes in spacetime and let congruent segments of otherwise-separate universes merge."
    – user1030
    Commented May 7, 2012 at 17:37
  • @Joe The speed of computation was a matter of practicality, but it didn't change what the computer was doing. My point is that mechanizing what the monks were doing and achieving the same result proves the Church-Turing thesis as applied to metaphysics, which I think matches the specs of your question.
    – Kyle Jones
    Commented May 7, 2012 at 18:34
  • 1
    @KyleJones: "proves the Church-Turing thesis as applied to metaphysics" - The Church-Turing thesis is already a metaphysical thesis, so I'm not sure what this means. The monks in the story were just using a computer to "do religion" like we use them to "do taxes". That's not the same as postulating theorem proving per se and occult ritual are the same thing.
    – user1030
    Commented May 7, 2012 at 19:39

I would mention Rick Cook's Wizardry series which began in 1989 with "Wizard's Bane" and ended with 4 sequels and one unfinished work. Not quite as early as the Japanese series but posits the equivalence you ask about exactly.

  • 1
    I specifically called out this series as not the kind of thing I was looking for. This is just a book with a system of magic that's formalized enough to be attractive to programmers.
    – user1030
    Commented May 8, 2012 at 6:52

The works of H P Lovecraft (themselves, of course, the inspiration for Stross's stories) are infused with mathematical themes. While not concerning calculation or algorithms per se, Lovecraft had stories in which understanding certain mathematical principles could allow you to perform actions that could be described as magical (although the entire Lovecraft mythos is written from the perspective that this is advanced science that is not fully understood and not magic per se, the results are very much those that would usually be described as magical).

Dreams in the Witch House is perhaps the most illustrative. Various quotations show how Lovecraft equated mathematical understanding with the ability to perform magical feats:

Gilman came from Haverhill, but it was only after he had entered college in Arkham that he began to connect his mathematics with the fantastic legends of elder magic.


There was much in the Essex County records about Keziah Mason’s trial, and what she had admitted under pressure to the Court of Oyer and Terminer had fascinated Gilman beyond all reason. She had told Judge Hathorne of lines and curves that could be made to point out directions leading through the walls of space to other spaces beyond, and had implied that such lines and curves were frequently used at certain midnight meetings in the dark valley of the white stone beyond Meadow Hill and on the unpeopled island in the river. She had spoken also of the Black Man, of her oath, and of her new secret name of Nahab. Then she had drawn those devices on the walls of her cell and vanished.


As time wore along, his absorption in the irregular wall and ceiling of his room increased; for he began to read into the odd angles a mathematical significance which seemed to offer vague clues regarding their purpose. Old Keziah, he reflected, might have had excellent reasons for living in a room with peculiar angles; for was it not through certain angles that she claimed to have gone outside the boundaries of the world of space we know?


What made the students shake their heads was his sober theory that a man might—given mathematical knowledge admittedly beyond all likelihood of human acquirement—step deliberately from the earth to any other celestial body which might lie at one of an infinity of specific points in the cosmic pattern. Such a step, he said, would require only two stages; first, a passage out of the three-dimensional sphere we know, and second, a passage back to the three-dimensional sphere at another point, perhaps one of infinite remoteness. [...] Professor Upham especially liked his demonstration of the kinship of higher mathematics to certain phases of magical lore transmitted down the ages from an ineffable antiquity—human or pre-human—whose knowledge of the cosmos and its laws was greater than ours.

It eventually transpires that the protagonist, having managed to begin to understand the necessary extra-dimensional geometry and is able to picture the correct angles has started to break through and travel through dimensions in his dreams.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.