## The 17-armed spiral within a spiral

Last Friday I visited my high school math camp, HCSSiM, where I became a nerd. I also taught there multiple times over the years, and in 2012 I blogged my lectures.

Why the visit? You see, we loyal alums of HCSSiM have a tradition of going back every July 17th to celebrate “Yellow Pig day,” which consists of a talk where founder and director (David) Kelly talks extensively about fun facts regarding the number 17, which happens before dinner, and then after dinner we sing “yellow pig carols” and eat an enormous amount of cake in the shape of a yellow pig. You can learn more about this ridiculous and hilarious tradition here.

Anyhoo, this year we (I went with other nerds) missed the 17 talk because of traffic in Connecticut but we made it for the dinner and carols. Luckily at dinner I had the chance to talk to Kelly, and I asked him if there were any new 17 facts this year. He told me there was one, and it was slightly mysterious. This post is an attempt to explain it a bit.

The mathematical set-up is explained here. Namely, we start with something called the Ulam Spiral, which is simply a way to label the boxes of an infinite two-dimensional grid with the natural numbers. You start at some place and then spiral outwards from there. Here’s a picture:

OK, so the first thing to say is that, when you label the plane like this, primes tend to cluster along lines. I think this is what Ulam thought was cool about his spiral:

Now comes the observation. You need to know what a triangular number is first, though. Namely, it’s a number that corresponds to counting up how many dots you need to form a triangle. We say the nth triangular number corresponds to a triangle with n rows. Here are the first few:

When you highlight the triangular numbers in the Ulam Spiral, instead of the primes, then you get something that looks weird:

OK so if you count those spiral arms, you’ll see there are 17 of them. But does that last forever? And if so, why?

Well, the answer is going to be yes. And here’s a rough proof. Rough because it uses asymptotic limits, so technically I will not show that the above picture extends perfectly, but rather that it eventually does look like a spiral with 17 arms.

A famous story about Gauss tells us that the formula for the nth triangular number is

Also, by construction of the Ulam Spiral, the bottom right corner of each “spiral layer” is an odd square, and that if we call that number there will be boxes on the very next layer, corresponding to the 4 sides of the next layer plus the 4 corners of the next layer.

Now imagine that there’s a triangular number right on that bottom right corner. That would mean that for some

or in other words that

This is when things get asymptotic. Imagine that is very very large. That would mean that is too (everything here is a positive integer), and in particular that the term would dwarf the term above. In other words, we could approximate:

My next question is, how many triangular numbers would lie on the next layer of the spiral? Well, as we said above there are spots in the next layer, which we will approximate by and the triangular number coming after is which is bigger than corresponding to adding one layer to a triangle with rows. We will approximate by again ignoring small terms.

For that matter, the next few triangular numbers after come regularly, about spots after the first. Therefore there are about triangular numbers in the next row of the Ulam spiral. That comes out to which is about 2.83.

So far we’ve figured out that, when is huge, then after meeting the th triangular number on the th row, we will see two more, and get most of the way to a third, by going one more row.

Now let’s do that 6 more times. After traveling 6 rows past a triangular number, we will meet about more triangular numbers. But

which is very close to 17. So after traveling the Ulam Spiral for 6 rows, we will just about hit 17 triangular numbers, which will be more or less evenly spaced from each other.

What this means is that we should expect to see a spiral with 17 arms, but that when the picture is enlarged to include a very large number of rows, we will see the spiral shifting very slightly to the other direction.

By the way, I didn’t figure this out immediately. First I had a most delightful time understanding when, exactly, square numbers and triangular numbers coincide. In other words, I wanted to understand when there is a and an so that:

or

I might write this up in another post, but play around with it for a while if you get bored on the subway.

coool! …too bad Martin Gardner isn’t around to appreciate this!

LikeLike

I don’t understand the triangular number formula, k (k + 1)/2. That looks like the sum of any first n integers, whether the sum to a triangular number or not. Help?

LikeLike

You’re exactly right! Now just turn those numbers into dots and you’ve got a triangle.

LikeLike

A very long time ago I worked out some recurrence formulas for square triangular, square pentagonal and square hexagonal numbers: https://oeis.org/search?q=Marcos%20Carreira&fmt=short

LikeLike

If you zoom out far enough, I think the difference between 16.97 and 17 dots per 6 cycles will cause the spiral to look increasingly “sloped”. Perhaps at some far out point we will perceive a more diffuse collection of spirals reflecting a different approximation to 2\sqrt2.

LikeLike

We obviously need pictures!

LikeLike

I thought this is nice, so i tried with more larger numbers. First I calculated some numbers which are ‘more closer’ to 2sqrt2 then before, and this is the result:

(There are three numbers in a row: the third one is the number close to 2sqrt2. There are 14, 17, 82, 99, etc etc.)

Now I drew triangular numbers within Ulam spiral below 600*600=360000:

And I counted the number of spirals.

There are 99 spirals, which is in calculation. Wonderful!

LikeLike

Thanks for writing this post; this is a really cool piece of maths! If you’ll permit me, I have a question. Why base your argument on the supposition that there is a triangular number in the bottom right corner, e.g. a square triangular number? I understand the argument that follows, but the square triangular numbers make up a vanishingly small proportion of the triangular numbers, and accordingly for most triangular numbers there isn’t a value of n s.t. k^2 + k = n^2.

As such surely this assumption only works in the vicinity of a square triangular number & hence so too the result? Perhaps this is why the switch is made from a 3-armed spiral, to a 17-armed spiral, to a 99-armed spiral, and presumably on again?

Also, I think interestingly, just before each new spiral becomes apparent it seems that the previous spiral ‘turns square’. In the above picture it seems that the 17-armed spiral ‘turns square’ as the 99-armed spiral becomes apparent, and in the picture in your post the original 3-armed spiral ‘turns square’ as the 17-armed spiral becomes apparent. Any ideas why?

LikeLike

Yes, there doesn’t have to be. I just said that to fix ideas, but of course it only actually happens exactly that way every now and then, for solutions of k^2 + k = 2 n^2. But the great thing is, everything on the nth row is of order n^2, and the argument works anyway.

You’re also right that there are lots of different spirals; 17 is by no means the only one. However, because of the “every 6 rows” phenomenon with 17 points, it is the most obvious one when you see it from high up.

LikeLike