OFFSET
1,4
COMMENTS
The "Babylonian Spiral" is defined and illustrated in A256111. See also the MathPickle link.
LINKS
Alex Meiburg, Table of n, a(n) for n = 1..10000
MathPickle, Babylonian Spiral
Hugo Pfoertner, Illustration of spiral using Plot 2.
EXAMPLE
The first few points are (0,0), (0,1), (1,2), (3,2) -- thus the sequence starts out 0, 0, 1, 3.
MATHEMATICA
NextVec[{x_, y_}] :=
Block[{n = x^2 + y^2 + 1}, While[SquaresR[2, n] == 0, n++];
TakeSmallestBy[
Union[Flatten[(Transpose[
Transpose[Tuples[{1, -1}, 2]] #] & /@
({{#[[1]], #[[2]]}, {#[[2]], #[[1]]}})) & /@
PowersRepresentations[n, 2, 2], 2]],
Mod[ArcTan[#[[2]], #[[1]]] - ArcTan[y, x], 2 Pi] &, 1][[1]]
]
Accumulate[NestList[NextVec, {0, 1}, 500]][[;; , 1]]
CROSSREFS
KEYWORD
AUTHOR
Alex Meiburg, Dec 28 2017
EXTENSIONS
~
STATUS
approved