Find a way to determine to which fibonacci squares a given coordinate belongs

8

Figure

Given a random coordinate (x,y), determine in which square (squares are referenced by their sidelength) it is (or the borders of which squares). The squares are drawn in a counter clockwise direction, that is, the first square is drawn in the first quadrant, the one after is to the right, the one after that above, the next to the left and so on. The length of the square sides follows the fibonacci sequence (each new one is the sum of the two previous ones).

So, for example, given a coordinate (0,3) it should display 8, whereas (0,1) would display 0,1,2. Decimal coordinates are also aloud.

Citronmelisa

Posted 2018-10-06T19:37:20.217

Reputation: 81

Question was closed 2018-10-08T04:25:20.357

1Welcome to the site! I think this challenge is really interesting, but needs a couple edits as the people who put it on hold indicated. There needs to be a winning criterion, so I'm going to add the [tag:code-golf] tag since that is most commonly used. I'm also going to replace switch the x-y coordinates that you used as examples since the horizontal axis component is shown first in most notations. Feel free to revert any of the edits if they are not what you intended – dylnan – 2018-10-06T20:35:33.033

3Should $0,1,2$ be $0,1,5$? $0,1,2$ looks like the output of $(1,1)$ to me. – Erik the Outgolfer – 2018-10-06T22:02:33.390

@Citronmelisa What is the winning criteria? – user202729 – 2018-10-07T01:55:56.680

1

@dylnan Don't edit challenges to add winning criteria without OP's words.... https://codegolf.meta.stackexchange.com/questions/14838/on-editing-somebody-elses-off-topic-question-to-make-it-on-topic-without-the-ow

– user202729 – 2018-10-07T01:57:11.810

I rollback'd, but OP can edit it in whatever way they want. By the way Latex uses \$...\$, see also https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference

– user202729 – 2018-10-07T02:02:27.240

1Welcome to PPCG! Nice concept. But you have a weird case with the square you label 0. Unlike all other squares, it does not have area 0^2, instead it has area 1^2. Also, the 2 square is not the sum of preceding labels 1 and 0. The fib sequence is 0,1,1,2,3,5,8... but your sequence is 0,1,2,3,5,8.... Frustrating to answerers; many bytes of code just to avoid duplicate 1 labels. An alternative: same idea, but label the squares with the index 0,1,2,3,4,5... of the Fib sequence instead. So x=10, y=3 would yield (5,6,9) with 0-based labels instead of (8,13,55). – Chas Brown – 2018-10-07T03:19:58.180

Please add an objective winning criterion, such as [code-golf] – mbomb007 – 2018-10-07T19:33:02.207

1Why is the middle square labeled $0$ if it has side length $1$? – Post Rock Garf Hunter – 2018-10-07T19:53:55.780

No answers