[algogeeks] Re: Spiral number

2007-10-21 Thread Dhyanesh (ધયાનેશ)
Use the property that one of the diagonals has squares of odd numbers. So given a co-ordinate in that diagonal you know the number at that position. For positions not on that diagonal you can add/subtract appropriately and obtain the number you need. -Dhyanesh On 10/18/07, mukesh tiwari [EMAIL

[algogeeks] Re: Spiral number

2007-10-21 Thread Venkatraman S
On 10/18/07, mukesh tiwari [EMAIL PROTECTED] wrote: 21 22 23 24 25 26 20 7 8 9 10 19 6 1 2 11 18 5 4 3 12 17 16 15 14 13 let the coordinate of 1 is (0,0) ie origin then

[algogeeks] Re: Spiral number

2007-10-21 Thread Ajinkya Kale
Check out these 2 links which discuss the same problem. Some codes are also posted. http://groups.google.com/group/programming-challenges/browse_thread/thread/88bcbea02029c2bf http://groups.google.com/group/programming-challenges/browse_thread/thread/9acf71cb87e9ffd3 This is a good group