Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #19 May 24 2023 06:05:18
%S 0,1,1,1,0,-1,-2,-3,-3,-3,-3,-3,-3,-3,-2,-1,0,1,2,3,4,5,5,5,5,5,5,5,5,
%T 5,5,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-7,-7,-7,-7,-7,-7,-7,-7,-7,-7,
%U -7,-7,-7,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9
%N List of X-coordinates of point moving along one of the arms of a counterclockwise square spiral with four arms; A340945 gives Y-coordinates.
%H Rémy Sigrist, <a href="/A340944/b340944.txt">Table of n, a(n) for n = 0..10101</a>
%H Rémy Sigrist, <a href="/A340944/a340944.gp.txt">PARI program for A340944</a>
%H <a href="/index/Con#coordinates_2D_curves">Index entries for sequences related to coordinates of 2D curves</a>
%F a(n) = A340945(n) iff n belongs to A002939.
%F a(n) = - A340945(n) iff n = 4*x^2 - 6*x + 2 for some x.
%F a(n) = 0 iff n is an even square (A016742).
%F a(n) = Re z where z = (r-s*i)*i^s with s = round(sqrt(n)) = A000194(n) and remainder r = n - s^2. - _Kevin Ryde_, May 24 2023
%e The spiral starts as follows:
%e +-----+-----+-----+-----+
%e |7 6 5 4 |3 .
%e | | .
%e + +-----+-----+ + +
%e |8 | | |2 |
%e | | | | |
%e + + +-----+-----+ +
%e |9 | | |0 1 |
%e | | | | | .
%e + + + +-----+-----+ .
%e |10 | | .
%e | | | .
%e + + +-----+-----+-----+-----+
%e .11 .
%e .
%e - so a(0) = a(4) = 0,
%e a(1) = a(2) = a(3) = 1,
%e a(5) = -1,
%e a(6) = -2,
%e a(7) = a(8) = a(9) = a(10) = a(11) = -3.
%o (PARI) See Links section.
%o (PARI) a(n) = my(r,s=sqrtint(n,&r)); if(r>s, s++;r-=2*s-1); real((r-s*I)*I^s); \\ _Kevin Ryde_, May 24 2023
%Y Cf. A000194, A002939, A016742, A340171, A340945.
%K sign,easy,look
%O 0,7
%A _Rémy Sigrist_, Jan 30 2021