OFFSET
0,3
COMMENTS
The Spiral of Theodorus (a.k.a. Pythagorean spiral or Pythagoras's snail) results from constructing the square roots sqrt(2), sqrt(3), sqrt(4), ... as hypotenuse of the right triangle having the previous one as longer leg, and the shorter leg equal to 1, starting with the segment [0, 1] for sqrt(1). In the complex plane, this construction corresponds to a sequence z(n+1) = z(n) + i*z(n)/|z(n)|, starting with z(1) = 1 (and z(0) = 0 by convention).
This sequence lists those n for which the endpoint is closer to the x-axis than the preceding and next one (plus the two initial points 0 and 1 which are the only ones lying directly on the x-axis). In terms of the complex sequence z(n), this means the indices n such that abs(Im(z(n)) <= abs(Im(z(n +- 1))).
The two initial terms correspond to the points (0, 0) and (1, 0), which can be regarded as the start of the Pythagorean spiral, and are the only points exactly on the x-axis.
There is a smooth complex-valued function z: [0,oo) -> C, t |-> z(t), which interpolates the spiral in non-integer values. In terms of this function, a(n) = round(t(n)) where t(n) is the n-th zero of the imaginary part of z (if indexing starts with 0 for t(0) = 0, then t(1) = 1, and t(2) ~ 6.8 where z(6.8) = -1). (This function has a natural extension to the whole of R including also the negative real line, but we don't consider negative arguments here.)
LINKS
Christian Mercat, Escargot de Pythagore: Spirale des racines carrées d'entiers, GeoGebra.org, Dec. 12, 2015
Wikipedia, Spiral of Theodorus, as of March 14, 2022
PROG
(PARI) z=!t=y=0; [n | n<-[0..10^4], ![t < t=y, y > y=abs(imag(z))]*z*=1+I/abs(z)]
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Mar 31 2022
STATUS
approved