1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Square spiral algorithm

  1. Jul 22, 2014 #1
    The problem statement

    Form a formula to generate every value in the 10x10 square spiral shown above. Use the variables: x = the column of the cell, y = the row of the cell, s = the size of the spiral (in this case 10).

    The formula must work for any size of spiral, where s is the width and height of the spiral.

    Solution attempt

    Let a = the value of the cell
    a = x + y - 1
    This works for the first row and the first column of 10-19, but doesn't work for any further numbers.
    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Jul 22, 2014 #2


    User Avatar

    Staff: Mentor

    Hi SxS. Welcome to the famous Physics Forums! :smile:

    Have you thought how you might present your answer? That might be a good place to start. Try and work out what the answer would look like. Imagine that someone were to hand you the correct answer all figured out....how would you recognize it as being correct? What form would the answer take?

    Not until you have thought about what the answer will look like will you be at the right place to start thinking of an approach to getting that answer.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted