In an electrical network, if resistors x and y are placed in series their total resistance is x + y; if they’re placed in parallel it’s 1/(1/x + 1/y).

This offers an intriguing opportunity for self-reference. Each of the networks above contains four resistors with values 1, 2, 3, and 4, and the total resistances of the networks themselves are 1, 2, 3, and 4. So any one of the numbered resistors in these networks can be replaced by one of the networks themselves.

The challenge was posed by Sallows and Stan Wagon as a Macalester College “problem of the week”; these examples were discovered by Brian Trial, an automotive electronics engineer from Ferndale, Mich. Sallows points out that any such solution has a dual that results from changing series connections to parallel, and vice versa, and then replacing all resistors values by their reciprocals.

This leads to a further idea: The two sets of resistors below are “co-replicating” — the four networks on the left can be used to replace the four resistors in any of the networks on the right, and vice versa.

The goal of the Shakespeare programming language is to create code that reads like a Shakespearean play: Variables are “characters” that interact through dialogue, constants are represented by nouns and adjectives, and if/then statements are phrased as questions. (Insulting Macbeth assigns him a negative value.) Act and scene numbers serve as GOTO labels, and characters can tell one another to “remember” or “recall” values. The phrases “Open your heart” and “Speak your mind” output a variable’s numerical value and the corresponding ASCII character, respectively.

This program prints the phrase HELLO WORLD:

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.
Act I: Hamlet's insults and flattery.
Scene I: The insulting of Romeo.
[Enter Hamlet and Romeo]
Hamlet:
You lying stupid fatherless big smelly half-witted coward! You are as
stupid as the difference between a handsome rich brave hero and thyself!
Speak your mind!
You are as brave as the sum of your fat little stuffed misused dusty
old rotten codpiece and a beautiful fair warm peaceful sunny summer's
day. You are as healthy as the difference between the sum of the
sweetest reddest rose and my father and yourself! Speak your mind!
You are as cowardly as the sum of yourself and the difference
between a big mighty proud kingdom and a horse. Speak your mind.
Speak your mind!
[Exit Romeo]
Scene II: The praising of Juliet.
[Enter Juliet]
Hamlet:
Thou art as sweet as the sum of the sum of Romeo and his horse and his
black cat! Speak thy mind!
[Exit Juliet]
Scene III: The praising of Ophelia.
[Enter Ophelia]
Hamlet:
Thou art as lovely as the product of a large rural town and my amazing
bottomless embroidered purse. Speak thy mind!
Thou art as loving as the product of the bluest clearest sweetest sky
and the sum of a squirrel and a white horse. Thou art as beautiful as
the difference between Juliet and thyself. Speak thy mind!
[Exeunt Ophelia and Hamlet]
Act II: Behind Hamlet's back.
Scene I: Romeo and Juliet's conversation.
[Enter Romeo and Juliet]
Romeo:
Speak your mind. You are as worried as the sum of yourself and the
difference between my small smooth hamster and my nose. Speak your
mind!
Juliet:
Speak YOUR mind! You are as bad as Hamlet! You are as small as the
difference between the square of the difference between my little pony
and your big hairy hound and the cube of your sorry little
codpiece. Speak your mind!
[Exit Romeo]
Scene II: Juliet and Ophelia's conversation.
[Enter Ophelia]
Juliet:
Thou art as good as the quotient between Romeo and the sum of a small
furry animal and a leech. Speak your mind!
Ophelia:
Thou art as disgusting as the quotient between Romeo and twice the
difference between a mistletoe and an oozing infected blister! Speak
your mind!
[Exeunt]

Because it’s written as a play, a program can be performed by human actors, but the drama lacks a certain narrative drive:

The sum of the proper divisors of 14316 is 19116.
The sum of the proper divisors of 19116 is 31704.
The sum of the proper divisors of 31704 is 47616.
The sum of the proper divisors of 47616 is 83328.
The sum of the proper divisors of 83328 is 177792.
The sum of the proper divisors of 177792 is 295488.
The sum of the proper divisors of 295488 is 629072.
The sum of the proper divisors of 629072 is 589786.
The sum of the proper divisors of 589786 is 294896.
The sum of the proper divisors of 294896 is 358336.
The sum of the proper divisors of 358336 is 418904.
The sum of the proper divisors of 418904 is 366556.
The sum of the proper divisors of 366556 is 274924.
The sum of the proper divisors of 274924 is 275444.
The sum of the proper divisors of 275444 is 243760.
The sum of the proper divisors of 243760 is 376736.
The sum of the proper divisors of 376736 is 381028.
The sum of the proper divisors of 381028 is 285778.
The sum of the proper divisors of 285778 is 152990.
The sum of the proper divisors of 152990 is 122410.
The sum of the proper divisors of 122410 is 97946.
The sum of the proper divisors of 97946 is 48976.
The sum of the proper divisors of 48976 is 45946.
The sum of the proper divisors of 45946 is 22976.
The sum of the proper divisors of 22976 is 22744.
The sum of the proper divisors of 22744 is 19916.
The sum of the proper divisors of 19916 is 17716.
The sum of the proper divisors of 17716 is 14316 again.

Create a strip of 19 triangles like the one above (printable version here) and fold the left portion back successively at each of the northeast-pointing lines to produce a spiral:

Fold this spiral backward along line ab:

Then fold the resulting figure backward at cd. You should be left with one blank triangular tab that can be folded backward and pasted to another blank panel on the opposite side. The resulting hexagon should have six 1s on one side and six 2s on the other.

With some adroit pinching this hexagon produces some marvelous effects. Fold down two adjacent triangles so that they meet, and then press in the opposite corner to join them. Now the top of the figure can be prised open and folded down to produce a new hexagon — this one with 1s on one face and a surprising blank on the second. What has become of the 2s?

Exploring the properties of this “hexahexaflexagon” offers an intuitive lesson in geometric group theory:

When Martin Gardner wrote about these bemusing creatures in his first column for Scientific American in 1956, he received two letters. The first was from Neil Uptegrove of Allen B. Du Mont Laboratories in Clifton, N.J.:

Sirs:

I was quite taken with the article entitled ‘Flexagons’ in your December issue. It took us only six or seven hours to paste the hexahexaflexagon together in the proper configuration. Since then it has been a source of continuing wonder.

But we have a problem. This morning one of our fellows was sitting flexing the hexahexaflexagon idly when the tip of his necktie became caught in one of the folds. With each successive flex, more of his tie vanished into the flexagon. With the sixth flexing he disappeared entirely.

We have been flexing the thing madly, and can find no trace of him, but we have located a sixteenth configuration of the hexahexaflexagon.

Here is our question: Does his widow draw workmen’s compensation for the duration of his absence, or can we have him declared legally dead immediately? We await your advice.

The second was from Robert M. Hill of The Royal College of Science and Technology in Glasgow, Scotland:

Sirs:

The letter in the March issue of your magazine complaining of the disappearance of a fellow from the Allen B. Du Mont Laboratories ‘down’ a hexahexaflexagon, has solved a mystery for us.

One day, while idly flexing our latest hexahexaflexagon, we were confounded to find that it was producing a strip of multicolored material. Further flexing of the hexahexaflexagon finally disgorged a gum-chewing stranger.

Unfortunately he was in a weak state and, owing to an apparent loss of memory, unable to give any account of how he came to be with us. His health has now been restored on our national diet of porridge, haggis and whisky, and he has become quite a pet around the department, answering to the name of Eccles.

Our problem is, should we now return him and, if so, by what method? Unfortunately Eccles now cringes at the very sight of a hexahexaflexagon and absolutely refuses to ‘flex.’

“The Joker,” a picture-preserving geomagic square by Lee Sallows. The 16 pieces can be assembled in varying groups of 4 to produce the same picture in 16 different ways, without rotation or reflection.

The outline need not be a joker — it can take almost any shape.