Monday, July 20, 2009

Monday Math Madness #37: Spiral Numbers, Part 2

I really like this contest, held at Wild About Math! every other Monday. Maybe because I won a prize the first time I entered. Or maybe because the first person I encouraged to try one of these got it, after just enough effort to make his victory sweet.

Background from #36 (part 1):

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.

Here's this week's contest problem:
  1. Come up with an algorithm that tells what number is at an arbitrary X, Y coordinate.
  2. Come up with an algorithm that tells the X, Y coordinates for an arbitrary positive integer.
Check out all the details at Wild About Math, and maybe you'll win a prize.

No comments:

Post a Comment

 
Math Blog Directory