Monday Math Madness 37 Solution

For my entry on MMM 37, I wrote the following solution in my e-mail. I hope I got it right. ^_^:

 The problem is to find the algorithm for the coordinate and number for the spiral that goes like the following:
25 24 23 22 21
10 09 08 07 20
11 02 01 06 19
12 03 04 05 18
13 14 15 16 17
 
Basically, this is how the spiral goes:
From the starting point, it goes -1 via x, then -1 via y, then 2 via x, 2 via y, then -3 via x
and it repeats itself like that so that:
  
x-0 + -1  +    2 +      -3     +…
y-0   +  -1   +   2   +      -3 +…
 
This comes from the fact that the sqare enveloping the square below always has its number starting
below the top left number, the highest one, which follows (2n+1)^2.
If so, then it has to go 2n-1 down (since the number below the top left one is already there), 2n to the right (enveloping the bottom part of the square below and jutting out),
2n up, then 2n+1 to the left to completely cover the square below and start the next square. Also, the one previous to 2n-1 down is 2n-1 left because of the smaller square.
 
So basically,add up the numbers from the sum above to find x and y.
The sum above is the alternating series:
Sum n-(1 to n) ((-1)^n)*n
 
The equation above can be used in the followin condition:
(1)The equation above for x and y, n can be the same,
or (2) n in x equation is 1 higher than n in y.
With those conditions, you can proceed to find the numbers in between by just adding numbers in x for condition (1)
or by adding numbers in y in condition (2)
 
Then, using those same numbers from the sum, plug it in the equation below and add it in the following way:
 
n=1+(sum |x|)+(sum |y|)
 
For example:
x=-1+1=0     n=1+(|-1|+|1|)+(|-1|)=3
y=-1
 
x=5=-1+2-3+4-5+6-7+8-9+10
y=2=-1+2-3+4-5+6-7+8-9+7
Plugged it in n=1+(|-1|+|2|+|-3|+…+|10|)+(|-1|+|2|+|-3|+…+|7|)=1+55+52=108
In the above case, a summation formula helps.
 
Albeit this method is really bad if you want to use large numbers. 😦
Although it helps if you use 2a=n (in this case, n is the term in the series, a is the “answer”)
since it alternates like this: -1, 1, -2, 2, etc

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: