cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A010751 Up once, down twice, up three times, down four times, ...

This page as a plain text file.
%I A010751 #62 Aug 05 2025 15:26:21
%S A010751 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 A010751 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 A010751 -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 A010751 Up once, down twice, up three times, down four times, ...
%C A010751 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 A010751 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 A010751 <a href="/index/Con#coordinates_2D_curves">Index entries for sequences related to coordinates of 2D curves</a>
%F A010751 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 A010751 From _David A. Corneth_, Jun 02 2018: (Start)
%F A010751 a(A007590(k)) = a(floor(k^2 / 2)) = 0.
%F A010751 a(A000384(k)) = a(binomial(2 * k, 2)) = k, a new maximum so far.
%F A010751 a(A014105(k)) = a(binomial(2 * k + 1, 2)) = -k, a new minimum so far.
%F A010751 (End)
%F A010751 a(n) = (-1)^A002024(n+1)*(A007590(A002024(n+1))-n). - _William McCarty_, Jul 30 2021
%e A010751 From _Stefano Spezia_, Jan 02 2022: (Start)
%e A010751 The array A begins with:
%e A010751    0   1   1   2   2   3   3 ...
%e A010751    0   0   1   1   2   2   3 ...
%e A010751   -1   0   0   1   1   2   2 ...
%e A010751   -1  -1   0   0   1   1   2 ...
%e A010751   -2  -1  -1   0   0   1   1 ...
%e A010751   -2  -2  -1  -1   0   0   1 ...
%e A010751   ...
%e A010751 (End)
%t A010751 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 A010751 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 A010751 (PARI) step=-1;print1(x=0,", ");for(stride=1,12,step=-step;for(k=1,stride,print1(x+=step,", "))) \\ _Hugo Pfoertner_, Jun 02 2018
%o A010751 (Python)
%o A010751 from math import isqrt
%o A010751 def A010751(n): return n-(m**2>>1) if (m:=isqrt(n+1<<3)+1>>1)&1 else (m**2>>1)-n # _Chai Wah Wu_, Jun 08 2025
%Y A010751 Cf. A000384, A002024, A007590, A014105, A305258.
%K A010751 sign,easy,tabl
%O A010751 0,7
%A A010751 David Berends (dave(AT)pgt.com)