# Wild About Math!Making Math fun and accessible

18Jul/091

## MMM #36: Spiral Numbers – Winner!

27 of you submitted solutions to MMM #36. Random.org has selected Mathias Malandain as the winner. Congratulations, Mathias!

This was the problem:

Imagine arranging the positive integers in a spiral pattern.
The numbers from 1 to 16 look like this in the spiral pattern.

```10  9  8  7
11  2  1  6
12  3  4  5
13 14 15 16
```

The location of each number corresponds to an X,Y Cartesian coordinate where the number 1 is at the origin: (0,0).
2 is at (-1,0). 3 is at (-1,-1). 4 is at (0,-1). 5 is at (1,-1). 6 is at (1,0). 7 is at (1,1) and so on.

What is the X,Y coordinate of the number 1,000,000?

Most people solved the problem by noticing where squares lie in the spiral.

Here's Mathias' solution:

1 is at (0,0), and then it's a spiral. We clearly see that 4 is at (0;-1). After that, reaching 4 we have built a square 2x2 ; so we will build a 4x4 square by adding 4 times 2 numbers (the sides), and 4 numbers more (the corners). And we will reach 16, i.e. 4 times 4.

More generally, when we reach the integer n², thus making a n by n square, we have to add 4n+4 numbers to build a (n+2) by (n+2) square. Once this large square is built, the integer (n+2)², that I'll write as (2k+2)², will be located at (k;-k-1). I will not write an induction proof... quite easy, I think. [Every time we go from n² to (n+2)², we add (1,-1) to our coordinates as we go south-east, so that etc.]

So 1.000.000, i.e. (2x499+2)², is at (499;-500).

Kerick had a more detailed explanation:

I'm a Brazilian student of Chemistry, and I'd like to congratulate you for the initiative creating this site.

About the MMM #36, my answer is that the coordinates of the number 10^6 are X=499 and Y=-500.

Explanation:

The key to solve this problem is perceive that this number matrix can be seen as a sequence of squares nested inside other squares. The fist one is a 2X2 square and its sides are composed by the numbers 1 to 4; the second one is a 4x4 and its sides are the numbers from 5 to 16; the third is a 6x6 and its sides are the numbers from 17 to 36, and so on. Here a clear pattern emerges: The last number of the N-th square is too the number of elements inside it, given by (2*N)*(2*N)=4*N^2:

Square number 1 has 2X2=4 elements;
Square number 2 has 4X4=16 elements;
Square number 3 has 6X6=36 elements;
.
.
.
Square number N has (2*N)*(2*N)=4*N^2 elements.

So, we can conclude that the last element in each square is always the square of a even number. But 10^6 is the square of 1000, an even number, and we can conclude 10^6 is the last number in some square. To determine which is it, we can use the formula deduced above:

4*N^2=10^6 ==> N = 500;

Then 10^6 is the last number of the square number 500.

To determine it's coordinates in the grid, it's enough to see the grid and perceive that the last elements of each square are all placed in a diagonal running through 4,16,36...

4, last element of the square number 1 has coordinates (X,Y)=(0,-1);
16, last element of the square number 2 has coordinates (X,Y)=(1,-2);
36, last element of the square number 3 has coordinates (X,Y)=(2,-3);
.
.
.
4*N^2, last element of the square number N has coordinates (X,Y)=((N-1),-N);

So, we can conclude that 10^6, last element of the square number 500 has coordinates (X,Y)=((500-1),-500)=(499,-500).

Jacques Descartes submitted a nice picture highlighting the squares of even numbers among the spiraling numbers. I'm not able to get to my server right now to upload the picture but I will later.

There's a nice proof by induction at Watchmath.

Check back in on Monday for the next MMM.

1. Hi, I posted my solution on my blog here: http://watchmath.com/vlog/?p=395 .

Thanks