at your original list of numbers, if I am to go through and check manually to see what I should be getting out, I think you should only get a few outputs (which is why I was confused by all the outputs at the end of the definition.
For example, just as an example I started with X1 as 279 (item index 11). When I did the math, the only indexes that I got were 15,28, and 33.
This is because:
since 279 is positive, look for next number that is at least 180 less or 360 more than X1.
the value of 78 (item index 15) is the first value to satisfy this requirement.
Then, since 78 is smaller than 279, we are looking for the next value at least 180 more or 360 less than 78.
The value 272 (item index 28) is that next value.
Then since 272 is larger than 78, we are looking for the next value at least 180 less or 360 more than 272.
The value 52 (item index 33) is the next value.
So the definition should output the following:
indexes 15, 28, 33.
Does that make sense?…
Added by Brian Harms at 4:20pm on December 10, 2011