## Need to take a hiatus

I'm needing to take a couple of weeks of hiatus from the blog. I shall return!

## MMM #37: Prize 4

Alan provided a very different solution from the others and provided a Matlab program for his solution:

I wrote a solution in MATLAB - I think its only uses standard mathematical functions, but I'll clarify if needed.

inputs/outputs

(x,y): as defined in your post

z: integer value at coordinate (x,y)intermediate variables:

r0: which square 'ring' the coordinate is on. 1 is ring 0, 2-9 is ring 1, etc

z1, z2: the first and last numbers in each ring

s: which side of the square a number is on: left = 0, bottom = 1, right = 2, top = 3

l: signed distance from point to center of whichever side its on

t: angle made between point-origin line and side center-origin linefunction [x y] = ValueToCoordinates(z)

r0 = round(sqrt((z-1)/4)); % which ring is it in?

z1 = (2*r0-1).^2+1 - 2*(z==1); % lower bounding perfect odd square (+1)

z2 = (2*r0+1).^2; % upper bounding perfect odd squarel = mod(z-z1, (z2-z1+1)/4) - r0+1; % distance along side

s = floor(4*(z-z1)./(z2-z1+1)); % which side of ring?

t = atan(l./r0) ; % angle wrt origin-side perpendicularx = r0.*cos(t+s*pi/2-pi) .* abs(sec(t)); % r(t) = r0*sec(t) is polar line

y = r0.*sin(t+s*pi/2-pi) .* abs(sec(t)); % we know base radius and anglefunction z = CoordinatesToValue(x,y)

r0 = max(abs(x),abs(y)); % which ring

z1 = (2*r0-1).^2+1; % lower bounding squareT = mod(atan2(y,x),2*pi); % absolute angle of point

s = floor(mod(T - 3*pi/4-r0/1e12, 2*pi)*2/pi); % need to subtract slightly less than 3pi/4

t = mod(T - s*pi/2-pi,2*pi); % angle wrt origin-side perpendicular

l = round(tan(t).*r0); % distance along sidez = z1 + (2*s+1).*r0 - 1 + l;

## MMM #37: Prizes 2 and 3

Today I'm announcing two more prizes for MMM #37.

Here is IB Yea's solution:

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 17Basically, 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 included), 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)*nThe equation above can be used in the following 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=-1x=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

Watchmath has solutions posted here and here.

Stay tuned for a few more solutions and prizes.

## MMM #37: Prize #1

I'm going to give a number of $10 prizes for MMM #37. Here's the first to Alec Cooper for his very elegant solution. I paid Alec to look through all the submissions to determine which were correct. Most were. I'll be giving a prize to everyone who turned in a correct solution and I'll be publishing each of them as well, one or two per posting. No, I won't be giving double prizes to folks who solved both problems.

Alec solved both problems and even sent me some Java code that performs the second algorithm.

Here are Alec's solutions.

Here's part 1:

And, here's part 2:

Stay tuned for more postings of solutions and more prizes.

## MMM #38: square or no square?

Results of MMM #37 should be out in the next couple of days.

Here's MMM #38:

Prove or disprove: The product of any four consecutive integers is always one less than a perfect square.

Don't assume the integers are all positive.

## Still working on reviewing MMM #37

I got submissions from eight people for this latest problem. Yes, this problem was tougher than most so I'm delighted to have gotten so many entries. I recently started work on a big software development project on a very tight schedule so I've not had the time to check each solution for correctness and that's what's delaying the announcement of winners. I'm paying one of the submitters to check all of the entries. What he'll probably do is run the algorithms against a set of numbers and confirm that they produce the expected answers. In a few days I should be ready to award some prizes.

In the meantime, you are welcome to post your solution on your personal blog if you have one. I'm always happy to link to people's blog entries but please don't ever post your solution until after submissions are due. For this particular contest I will publish all correct solutions.

Even though I'm behind in reviewing this contest I'll still post MMM #38 tomorrow. Sorry for the delay.