login
Up once, down twice, up three times, down four times, ...
9

%I #52 Aug 04 2024 02:55:45

%S 0,1,0,-1,0,1,2,1,0,-1,-2,-1,0,1,2,3,2,1,0,-1,-2,-3,-2,-1,0,1,2,3,4,3,

%T 2,1,0,-1,-2,-3,-4,-3,-2,-1,0,1,2,3,4,5,4,3,2,1,0,-1,-2,-3,-4,-5,-4,

%U -3,-2,-1,0,1,2,3,4,5,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-5,-4

%N Up once, down twice, up three times, down four times, ...

%C Also x-coordinates of a point moving in a spiral rotated by Pi/4, with y-coordinates given by A305258. - _Hugo Pfoertner_, May 29 2018

%C This sequence is also obtained by reading alternately in ascending or descending way the antidiagonals of the array defined as A(i, j) = floor((j - i + 1)/2) (see Example). - _Stefano Spezia_, Jan 02 2022

%H <a href="/index/Con#coordinates_2D_curves">Index entries for sequences related to coordinates of 2D curves</a>

%F a(n) = x + 1 - (sign(x(2x+1) - y(2y+1)))*(n-2x^2-3x-1) where x = floor((-1-sqrt(1+8n))/4), y = -floor((1-sqrt(1+8n))/4), sign(x) = abs(x)/x when x is not 0 and sign(0) = 0, floor(x) is the greatest integer less than or equal to x, sqrt(x) is the principal square root of x and abs(x) is the absolute value (or magnitude) of x. - _Mark Spindler_, Mar 25 2004

%F From _David A. Corneth_, Jun 02 2018: (Start)

%F a(A007590(k)) = a(floor(k^2 / 2)) = 0.

%F a(A000384(k)) = a(binomial(2 * k, 2)) = k, a new maximum so far.

%F a(A014105(k)) = a(binomial(2 * k + 1, 2)) = -k, a new minimum so far.

%F (End)

%F a(n) = (-1)^A002024(n+1)*(A007590(A002024(n+1))-n). - _William McCarty_, Jul 30 2021

%e From _Stefano Spezia_, Jan 02 2022: (Start)

%e The array A begins with:

%e 0 1 1 2 2 3 3 ...

%e 0 0 1 1 2 2 3 ...

%e -1 0 0 1 1 2 2 ...

%e -1 -1 0 0 1 1 2 ...

%e -2 -1 -1 0 0 1 1 ...

%e -2 -2 -1 -1 0 0 1 ...

%e ...

%e (End)

%t n=(the index); x = -1; y = 0; While[n != 0, While[y != x && n != 0, y--; n-- ]; While[y != -x && n != 0, n--; y++ ]; x-- ]; Print[ -y] (* provided by Gregory Puleo *)

%t n = (the index); a = Floor[(-1 - Sqrt[1 + 8* n])/4]; b = -Floor[(1 - Sqrt[1 + 8*n])/4]; a + 1 - Sign[a*(2*a + 1) - b*(2*b + 1)]*(n - 2*a^2 - 3*a - 1) (* _Mark Spindler_, Mar 25 2004 *)

%o (PARI) step=-1;print1(x=0,", ");for(stride=1,12,step=-step;for(k=1,stride,print1(x+=step,", "))) \\ _Hugo Pfoertner_, Jun 02 2018

%Y Cf. A000384, A002024, A007590, A014105, A305258.

%K sign,easy

%O 0,7

%A David Berends (dave(AT)pgt.com)