Megan Schmidt is obsessed with spirals. Her obsession got me hooked — for *hours* — on a math problem. I thought it would take maybe an hour or two, but I’m still at it and I’ve probably been working four or five hours.

I’ve been having *so much fun with it*.

Here’s the problem. Look at the spiral below…

We see that 1 is located at (0,0).

We see that 2 is located at (0,1).

We see that 8 is located at (-1,0).

If we continue this spiral in this manner, can you come up with a formula for the coordinates of the *k*th number?

So what I want to know is if we consider the number 2016, can we come up with a way to precisely define where it is? What about 820526487?

One easy way around this is to write a computer program that just brute forces our way through it. So here’s the constraint: I want a closed formula for the x-coordinate and y-coordinate. That means no recursion! No if/then statements! Just an equation that relies on *k* only.

You know one of the most frustrating things? Going down a path and feeling good about it, even though it is pretty complicated. And then having a new insight on how to attack the problem (which *just* happened to me now as I typed up the problem and look at the image I created for this post) [1]. And realizing that approach *might* yield it’s secrets so much easier!

In any case, I thought I’d share the problem because it’s given me so much enjoyment thus far. If you do get obsessed and solve it, please feel free to put your answer in the comments. I have a feeling there are a variety of valid solutions which look very different but yield the same answer.

[1] What this reminds me is how slight changes in representations can lead to new insights! Before I was using this image that Megan sent me:

**UPDATE!: I solved it!**

If you want to see that I did solve it, check out this Geogebra sheet. It won’t give away *how* I solved it (unless you download it, look at how I defined each cell, and then reverse engineered it).

https://www.geogebra.org/m/cXhwYh3P

So yeah… 2016 is at (-22,13), and 820526487 is at (-14322, 4784).

I am so proud of myself! I came up with a closed form solution!!!

I am going to put a “jump” below here, and then show what my solution is, and write a little about it.** So only read below the jump (meaning: after this) if you want some spoilers.**