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.