Welcome to Project Lovelace! We're still in early development so there are still tons of bugs to find and improvements to make.
If you have any suggestions, complaints, or comments please let us know on Discourse, Discord, or GitHub!

Babylonian spiral

You will learn about:
weirdly surprising patterns.

A Babylonian spiral is constructed by starting with a zero vector at the origin of a Cartesian grid and progressively
concatenating the next longest vector with integer components. So the $i$th vector has integer components $(x_i, y_i)$
satisfying $x_i^2 + y_i^2 = n_i^2 > n_{i-1}^2$ where $x_i$, $y_i$ and $n_i$ are non-negative integers. The direction
of the new vector is chosen such that it minimizes the clockwise angular separation from the previous one.

Starting with the vectors $(x_0, y_0) = (0, 0)$ and $(x_1, y_1) = (0, 1)$ find the $x$ and $y$ coordinates of the Babylonian
spiral after $N$ steps.

Apparently the name Babylonian spiral was chosen to mislead school students into making an incorrect hypothesis
about the spiral's long-term behavior.

The On-Line Encyclopedia of Integer Sequences (OEIS) has three sequences related to the Babylonian spiral:
A256111, A297346,
and A297347.

Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to
discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion
thread below. Would be nice if you don't post solutions in there but if you do then please organize and
document your code well so others can learn from it.