WhirlpUlam

Stanislaw Ulam (pronounced OO-lam) was an American mathematician who was doodling one day in 1963 and created what is now called the Ulam spiral. It’s a spiral of integers on a square grid with the prime squares filled in and the composite squares left empty. At the beginning it looks like this (the blue square is the integer 1, with 2 to the east, 3 to the north-east, 4 to the north, 5 to the north-west, 6 to the west, and so on):

Ulam spiral


And here’s an Ulam spiral with more integers:

Ulam spiral at higher resolution


The primes aren’t scattered at random over the spiral: they often fall into lines that are related to what are called polynomial functions, such as n2 + n + 1. To understand polynomial functions better, let’s look at how the Ulam spiral is made. Here is a text version with the primes underlined:


Here’s an animated version:


Here’s the true spiral again with 1 marked as a blue square:

Ulam spiral centred on 1


What happens when you try other numbers at the centre? Here’s 2 at the centre as a purple square, because it’s prime:

Ulam spiral centred on 2


And 3 at the centre, also purple because it’s also prime:

Ulam spiral centred on 3


And 4 at the centre, blue again because 4 = 2^2:

Ulam spiral centred on 4


And 5 at the centre, prime and purple:

Ulam spiral centred on 5


Each time the central number changes, the spiral shifts fractionally. Here’s an animation of the central number shifting from 1 to 41. If you watch, you’ll see patterns remaining stable, then breaking up as the numbers shift towards the center and disappear (the central number is purple if prime, blue if composite):

Ulam whirlpool, or WhirlpUlam


I think the animation looks like a whirlpool or whirlpUlam (prounced whirlpool-am), as numbers spiral towards the centre and disappear. You can see the whirlpUlam more clearly here:
An animated Ulam Spiral pausing at n=11, 17, 41


WhirlpUlam again


Note that something interesting happens when the central number is 41. The spiral is bisected by a long line of prime squares, like this:

Ulam spiral centred on 41


The line is actually a visual representation of something David Wells wrote about in The Penguin Dictionary of Curious and Interesting Numbers (1986):

Euler discovered the excellent and famous formula x2 + x + 41, which gives prime values for x = 0 to 39.

Here are the primes generated by the formula:

41, 43, 47, 53, 61, 71, 83, 97, 113, 131, 151, 173, 197, 223, 251, 281, 313, 347, 383, 421, 461, 503, 547, 593, 641, 691, 743, 797, 853, 911, 971, 1033, 1097, 1163, 1231, 1301, 1373, 1447, 1523, 1601

You’ll see other lines appear and disappear as the whirlpUlam whirls:

Ulam spiral centred on 17


Primes in line: 17, 19, 23, 29, 37, 47, 59, 73, 89, 107, 127, 149, 173, 199, 227, 257 (n=0..15)


Ulam spiral centred on 59


Primes in line: 59, 67, 83, 107, 139, 179, 227, 283, 347, 419, 499, 587, 683, 787 (n=0..13)


Ulam spiral centred on 163


Primes in line: 163, 167, 179, 199, 227, 263, 307, 359, 419, 487, 563, 647, 739, 839, 947, 1063, 1187, 1319, 1459, 1607 (n=0..19)


Ulam spiral centred on 233


Primes in line: 233, 241, 257, 281, 313, 353, 401, 457, 521, 593, 673, 761, 857 ((n=0..12)


Ulam spiral centred on 653


Primes in line: 653, 661, 677, 701, 733, 773, 821, 877, 941, 1013, 1093, 1181, 1277, 1381, 1493, 1613, 1741, 1877 (n=0..17)


Ulam spiral centred on 409,333


Primes in line: 409,333, 409337, 409349, 409369, 409397, 409433, 409477, 409529, 409589, 409657, 409733, 409817, 409909, 410009, 410117, 410233 (n=0..15)


Some bisect the centre, some don’t, because you could say that the Ulam spiral has six diagonals, two that bisect the centre (top-left-to-bottom-right and bottom-left-to-top-right) and four that don’t. You could also call them spokes:


If you look at the integers in the spokes, you can see that they’re generated by polynomial functions in which c stands for the central number:

North-west spoke: 1, 5, 17, 37, 65, 101, 145, 197, 257, 325, 401, 485, 577, 677, 785, 901, 1025, 1157, 1297, 1445, 1601, 1765, 1937, 2117, 2305, 2501, 2705, 2917... = c + (2n)^2


South-east spoke: 1, 9, 25, 49, 81, 121, 169, 225, 289, 361, 441, 529, 625, 729, 841, 961, 1089, 1225, 1369, 1521, 1681, 1849, 2025, 2209, 2401, 2601, 2809, 3025, 3249, 3481, 3721, 3969, 4225, 4489, 4761, 5041, 5329, 5625... = c+(2n+1)^2-1


NW-SE diagonal: 1, 5, 9, 17, 25, 37, 49, 65, 81, 101, 121, 145, 169, 197, 225, 257, 289, 325, 361, 401, 441, 485, 529, 577, 625, 677, 729, 785, 841, 901, 961, 1025, 1089, 1157, 1225, 1297, 1369, 1445, 1521, 1601, 1681 = c + n^2 + 1 - (n mod 2)


North-east spoke: 1, 3, 13, 31, 57, 91, 133, 183, 241, 307, 381, 463, 553, 651, 757, 871, 993, 1123, 1261, 1407, 1561, 1723, 1893, 2071... = c + (n+1)^2 - n - 1


South-west spoke: 1, 7, 21, 43, 73, 111, 157, 211, 273, 343, 421, 507, 601, 703, 813, 931, 1057, 1191, 1333, 1483, 1641, 1807, 1981, 2163... = c + (2n)^2 + 2n


SW-NE diagonal: 1, 3, 7, 13, 21, 31, 43, 57, 73, 91, 111, 133, 157, 183, 211, 241, 273, 307, 343, 381, 421, 463, 507, 553, 601, 651, 703, 757, 813, 871, 931, 993, 1057, 1123, 1191, 1261, 1333, 1407, 1483, 1561, 1641... = c + n^2 + n



Elsewhere other-engageable:

All posts interrogating issues around the Ulam spiral

Prime Time #2

“2n2 + 29 is prime for all values of n for 1 to 28.” — The Penguin Dictionary of Curious and Interesting Numbers, David Wells (1986).

• 31, 37, 47, 61, 79, 101, 127, 157, 191, 229, 271, 317, 367, 421, 479, 541, 607, 677, 751, 829, 911, 997, 1087, 1181, 1279, 1381, 1487, 1597.


Elsewhere other-posted:

Prime Time #1
Poulet’s Propellor — Musings on Math and Mathculinity
La Spirale è Mobile

Performativizing Papyrocentricity #14

Papyrocentric Performativity Presents:

Scheming DemonThe Screwtape Letters, C.S. Lewis (1942)

Ai Wei to HellHow to Read Contemporary Art, Michael Wilson (Thames & Hudson, 2013)

Toxic TwosomeDoll, Peter Sotos and James Havoc (TransVisceral Books, 2013)

Know Your LimaçonsThe Penguin Dictionary of Curious and Interesting Geometry, David Wells (1991) (posted @ Overlord of the Über-Feral)

Pestilent, Pustulent and Pox-Pocked – various books by Dr Miriam B. Stimbers (@ O.o.t.Ü.-F.)


Or Read a Review at Random: RaRaR

Know Your Limaçons

Front cover of The Penguin Dictionary of Curious and Interesting Geometry by David WellsThe Penguin Dictionary of Curious and Interesting Geometry, David Wells (1991)

Mathematics is an ocean in which a child can paddle and an elephant can swim. Or a whale, indeed. This book, a sequel to Wells’ excellent Penguin Dictionary of Curious and Interesting Mathematics, is suitable for both paddlers and plungers. Plumbers, even, because you can dive into some very deep mathematics here.

Far too deep for me, I have to admit, but I can wade a little way into the shallows and enjoy looking further out at what I don’t understand, because the advantage of geometry over number theory is that it can appeal to the eye even when it baffles the brain. If this book is more expensive than its prequel, that’s because it needs to be. It’s a paperback, but a large one, to accommodate the illustrations.

Fortunately, plenty of them appeal to the eye without baffling the brain, like the absurdly simple yet mindstretching Koch snowflake. Take a triangle and divide each side into thirds. Erect another triangle on each middle third. Take each new line of the shape and do the same: divide into thirds, erect another triangle on the middle third. Then repeat. And repeat. For ever.

A Koch snowflake (from Wikipedia)

A Koch snowflake (from Wikipedia)

The result is a shape with a finite area enclosed by an infinite perimeter, and it is in fact a very early example of a fractal. Early in this case means it was invented in 1907, but many of the other beautiful shapes and theorems in this book stretch back much further: through Étienne Pascal and his oddly organic limaçon (which looks like a kidney) to the ancient Greeks and beyond. Some, on the other hand, are very modern, and this book was out-of-date on the day it was printed. Despite the thousands of years devoted by mathematicians to shapes and the relationship between them, new discoveries are being made all the time. Knots have probably been tied by human beings for as long as human beings have existed, but we’ve only now started to classify them properly and even find new uses for them in biology and physics.

Which is not to say knots are not included here, because they are. But even the older geometry Wells looks at would be enough to keep amateur and recreational mathematicians happy for years, proving, re-creating, and generalizing as they work their way through variations on all manner of trigonomic, topological, and tessellatory themes.


Previously pre-posted (please peruse):

Poulet’s Propeller — discussion of Wells’ Penguin Dictionary of Curious and Interesting Numbers (1986)

Poulet’s Propeller

The Penguin Dictionary of Curious and Interesting Numbers (1986) is one of my favourite books. It’s a fascinating mixture of math, mathecdote and math-joke:

2·618 0333…

The square of φ, the golden ratio, and the only positive number such that √n = n-1. (pg. 45)


6

Kepler discussed the 6-fold symmetry of snowflakes, and attempted to explain it by considering the close packing of spheres in a hexagonal array. (pg. 69)


39

This appears to be the first uninteresting number, which of course makes it an especially interesting number, because it is the smallest number to have the property of being uninteresting.

It is therefore also the first number to be simultaneously interesting and uninteresting. (pg. 120)

David Wells, who wrote the Dictionary, “had the rare distinction of being a Cambridge scholar in mathematics and failing his degree”. He must be the mathematical equivalent of the astronomer Patrick Moore: a popularizer responsible for opening many minds and inspiring many careers. He’s also written books on geometry and mathematical puzzles. But not everyone appreciates his efforts. This is a sideswipe in a review of William Hartston’s The Book of Numbers:

Thankfully, this book is more concerned with facts than mathematics. Anyone wanting to learn more about [π] or the Fibonacci sequence should turn to the Penguin Dictionary of Curious and Interesting Numbers, a volume which none but propeller-heads will find either curious or interesting. (Review in The Independent, 18th December 1997)


Continue reading: Poulet’s Propeller

He Say, He Sigh, He Sow #14

39: This appears to be the first uninteresting number, which of course makes it an especially interesting number, because it is the smallest number to have the property of being uninteresting. It is therefore also the first number to be simultaneously interesting and uninteresting.” — David Wells, The Penguin Dictionary of Curious and Interesting Numbers (1986), entry for “39”, pg. 120

Three Is The Key

If The Roses of Heliogabalus (1888) is any guide, Sir Lawrence Alma-Tadema (1836-1912) thought that 222 is a special number. But his painting doesn’t exhaust its secrets. To get to another curiosity of 222, start with 142857. As David Wells puts it in his Penguin Dictionary of Curious and Interesting Numbers (1986), 142857 is a “number beloved of all recreational mathematicians”. He then describes some of its properties, including this:

142857 x 1 = 142857
142857 x 2 = 285714
142857 x 3 = 428571
142857 x 4 = 571428
142857 x 5 = 714285
142857 x 6 = 857142

The multiples are cyclic permutations: the order of the six numbers doesn’t change, only their starting point. Because each row contains the same numbers, it sums to the same total: 1 + 4 + 2 + 8 + 5 + 7 = 27. And because each row begins with a different number, each column contains the same six numbers and also sums to 27, like this:

1 4 2 8 5 7
+ + + + + +
2 8 5 7 1 4
+ + + + + +
4 2 8 5 7 1
+ + + + + +
5 7 1 4 2 8
+ + + + + +
7 1 4 2 8 5
+ + + + + +
8 5 7 1 4 2

= = = = = =

2 2 2 2 2 2
7 7 7 7 7 7

If the diagonals of the square also summed to the same total, the multiples of 142857 would create a full magic square. But the diagonals don’t have the same total: the left-right diagonal sums to 31 and the right-left to 23 (note that 31 + 23 = 54 = 27 x 2).

But where does 142857 come from? It’s actually the first six digits of the reciprocal of 7, i.e. 1/7 = 0·142857… Those six numbers repeat for ever, because 1/7 is a prime reciprocal with maximum period: when you calculate 1/7, all integers below 7 are represented in the remainders. The square of multiples above is simply another way of representing this:

1/7 = 0·142857…
2/7 = 0·285714…
3/7 = 0·428571…
4/7 = 0·571428…
5/7 = 0·714285…
6/7 = 0·857142…
7/7 = 0·999999…

The prime reciprocals 1/17 and 1/19 also have maximum period, so the squares created by their multiples have the same property: each row and each column sums to the same total, 72 and 81, respectively. But the 1/19 square has an additional property: both diagonals sum to 81, so it is fully magic:

01/19 = 0·0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1
02/19 = 0·1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2…
03/19 = 0·1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3…
04/19 = 0·2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4…
05/19 = 0·2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5…
06/19 = 0·3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6…
07/19 = 0·3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7…
08/19 = 0·4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8…
09/19 = 0·4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9…
10/19 = 0·5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0…
11/19 = 0·5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1…
12/19 = 0·6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2…
13/19 = 0·6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3…
14/19 = 0·7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4…
15/19 = 0·7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5…
16/19 = 0·8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6…
17/19 = 0·8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7…
18/19 = 0·9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8

First line = 0 + 5 + 2 + 6 + 3 + 1 + 5 + 7 + 8 + 9 + 4 + 7 + 3 + 6 + 8 + 4 + 2 + 1 = 81

Left-right diagonal = 0 + 0 + 7 + 5 + 5 + 9 + 0 + 3 + 0 + 4 + 2 + 8 + 7 + 5 + 6 + 7 + 5 + 8 = 81

Right-left diagonal = 9 + 9 + 2 + 4 + 4 + 0 + 9 + 6 + 9 + 5 + 7 + 1 + 2 + 4 + 3 + 2 + 4 + 1 = 81

In base 10, this doesn’t happen again until the 1/383 square, whose magic total is 1719 (= 383-1 x 10-1 / 2). But recreational maths isn’t restricted to base 10 and lots more magic squares are created by lots more primes in lots more bases. The prime 223 in base 3 is one of them. Here the first line is

1/223 = 1/220213 = 0·

0000100210210102121211101202221112202
2110211112001012200122102202002122220
2110110201020210001211000222011010010
2222122012012120101011121020001110020
0112011110221210022100120020220100002
0112112021202012221011222000211212212…

The digits sum to 222, so 222 is the magic total for all rows and columns of the 1/223 square. It is also the total for both diagonals, so the square is fully magic. I doubt that Alma-Tadema knew this, because he lived before computers made calculations like that fast and easy. But he was probably a Freemason and, if so, would have been pleased to learn that 222 had a link with squares.