|
|
A010751
|
|
Up once, down twice, up three times, down four times, ...
|
|
9
|
|
|
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, 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, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -5, -4
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,7
|
|
COMMENTS
|
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
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
|
|
LINKS
|
|
|
FORMULA
|
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
a(A007590(k)) = a(floor(k^2 / 2)) = 0.
a(A000384(k)) = a(binomial(2 * k, 2)) = k, a new maximum so far.
a(A014105(k)) = a(binomial(2 * k + 1, 2)) = -k, a new minimum so far.
(End)
|
|
EXAMPLE
|
The array A begins with:
0 1 1 2 2 3 3 ...
0 0 1 1 2 2 3 ...
-1 0 0 1 1 2 2 ...
-1 -1 0 0 1 1 2 ...
-2 -1 -1 0 0 1 1 ...
-2 -2 -1 -1 0 0 1 ...
...
(End)
|
|
MATHEMATICA
|
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 *)
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 *)
|
|
PROG
|
(PARI) step=-1; print1(x=0, ", "); for(stride=1, 12, step=-step; for(k=1, stride, print1(x+=step, ", "))) \\ Hugo Pfoertner, Jun 02 2018
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,easy,changed
|
|
AUTHOR
|
David Berends (dave(AT)pgt.com)
|
|
STATUS
|
approved
|
|
|
|